在ScriptSharp项目单元测试的C#代码 [英] Unit testing c# code in a ScriptSharp project

查看:114
本文介绍了在ScriptSharp项目单元测试的C#代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即时通讯使用ScriptSharp创建RIA应用程序。
,除了一些古怪的作品不错。

Im using ScriptSharp to create a RIA app. Works nice besides some oddities.

不过发现和修复使用Firebug是不是真的方便易问题。

However finding and fixing problems using Firebug isn't really convinient.

由于scriptsharp还提供了一个DLL我希望使用NUnit来测试我的代码的某些部分使用一个单独的testproject。

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

问题的出现是生成的dll引用MSCORLIB 0.7导致在测试项目的mscorlib 4的冲突。

Issue that arises is that the generated dll references mscorlib 0.7 resulting in conflict with mscorlib 4 in the test project.

一个简单的解决方案是围绕创建第二个普通的C#项目,并复制codefiles。但是,保持2个项目具有相同的代码库...

A simple solution is to create a second plain C# project and copy codefiles around. But maintaining 2 projects with the same code base...

好奇,如果有另一种方式来做到这一点。 ?有人

Curious if there is another way to do this. Anybody?

编辑:作为建议由基督教Dalager
液工作原理

Solution as proposed by Christian Dalager works.

小的事情是, ScriptSharp重新定义在mscorlib中System.Diagnostics程序。没有更多的Debug.Assert的/的WriteLine。但它几乎不再需要现在

Small thing is that ScriptSharp has redefined System.Diagnostics in mscorlib. No more Debug.Assert/Writeline. But there is almost no more need for it now.

推荐答案

您可以尝试使用的集绑定重定向

您会把这样的事情在您testproject在app.config。
还没有测试这种特殊的配置,所以你需要调整它。

You would put something like this in the app.config on your testproject. Havent tested this particular 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> 

这篇关于在ScriptSharp项目单元测试的C#代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆