Skip to content

UIs to write unit tests

Dinis Cruz edited this page Jan 10, 2015 · 1 revision

There are multiple ways to write UnitTests using the O2Platform and its multiple REPLs.

####Using the FluentSharp REPL

You can consume the NUnit Apis directly on the C# REPL:

Assert.IsTrue(int.MaxValue == 0x7FFFFFFF);
Assert.IsTrue(2==2);

return "all ok";
//using NUnit.Framework
//O2Ref:nunit.framework.dll

which can be re-written like this using the FluentSharp.NUnit apis

(int.MaxValue == 0x7FFFFFFF).assert_Is_True();  //Assert.IsTrue(int.MaxValue == 0x7FFFFFFF);
(int.MaxValue).assert_Is(0x7FFFFFFF);
2.assert_Bigger_Than(1);
2.assert_Is(2);									//Assert.IsTrue(2==2);

return "nunit.framework.dll".assembly();
//O2Ref:FluentSharp.NUnit
//using FluentSharp.NUnit

Using the 'Write for NUnitGUI'

Linked from the main O2 Platform UI, there is a tool called Write for NUnitGUI

image

  1. Chose that option to open the UI

image

  1. Click on Open Default Test File

image

  1. click on the RUN in NUnit GUI (save, compile, open and run) button

image

  1. Write a test that fails and see it fail in the UI

image

  1. You can also use the Run in NUnit Console link to run the test on the Console (which is a bit faster)

image

  1. The Run in NUnit Console also provides a nice visual clue for passing and failing tests

image

Other Resources and articles:

Related issues