Where to put xUnit tests to build F #?

I am working on my first "real" build of F # and try to do everything right.

I also managed to get xUnit to work, but currently my test module is inside the same assembly. This bothers me a bit because it means that I will post the assembly, where almost half of the code (and 80% of the API) are testing methods.

What is the “right” way to do this? If I put the tests in a different assembly, I think this means that I have to expose the internals, which I prefer to keep in private.

I know that in C # there is a mechanism for tests (if this is the correct terminology), is there an equivalent in F #?

Alternatively, can someone point me to an example project where this is done “correctly”?

+3
source share
1 answer

you can use InternalsVisibleTo-Attribute to expose your internal parts to some other assembly.

http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.internalsvisibletoattribute(VS.100).aspx

EDIT

If your assembly is signed, you will also need to sign the Friend assembly and provide the public key in the InternalsVisibleTo attribute:

[<assembly: InternalsVisibleTo("ProcessorTests, PublicKey=0024000004800...)")>]
+5
source

Source: https://habr.com/ru/post/1735879/


All Articles