If you are familiar with C # or Java or C ++, you can refer to an instance of the class using the reserved word this in the members of the instance. In F # you must explicitly specify a class instance name for each member definition and in the FsUnit example, this name is just test , but it is not actually used. You could write a test method in the same way as
[<Test>] member this. ``when I try to solve
But note that nowadays, both xUnit.net and NUnit allow you to use their attributes [<Fact>] and [<Test>] respectively, for marking tests that allow you to link functions inside modules without the need for TestFixture and those that are much better suited for F #. So, for example, the test you gave may, and in my opinion, should be written as:
module EulerProblemTests () = [<Test>] let ``when I try to solve
In addition, you probably do not want to create your own solutions to problems as type members like EulerProblem , but as functions inside a module.
source share