Unit Testing C # Code in a ScriptSharp Project

I am using ScriptSharp to create an RIA application. It works well, except for some oddities.

However, troubleshooting Firebug is not very convenient.

Since scriptsharp also provides Dll, I was hoping to use a separate test project using Nunit to test some parts of my code.

There is a problem: the created dll refers to mscorlib 0.7, which leads to a conflict with mscorlib 4 in the test project.

A simple solution is to create a second simple C # project and copy the code files. But supporting 2 projects with the same code base ...

Curious if there is another way to do this. Is anyone

EDIT: The solution proposed by Christian Dalager is working.

Not only did ScriptSharp redefine System.Diagnostics in mscorlib. No longer Debug.Assert / Writeline. But now he is no longer needed.

+4
source share
1 answer

You can try using assembly binding redirects

You would put something like this in app.config on your test project. Havent checked this specific configuration, so you will need to adjust it.

<runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" appliesTo="v1.0.3705"> <dependentAssembly> <assemblyIdentity name="mscorlib" publicKeyToken="b77a5c561934e089" culture="neutral"/> <bindingRedirect oldVersion="0.7.0.0" newVersion="4.0.0.0"/> </dependentAssembly> </assemblyBinding> </runtime> 
+3
source

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


All Articles