Nunit .net对比Mono [英] Nunit .net vs mono

查看:81
本文介绍了Nunit .net对比Mono的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用C#使用asp.net mvc编写了一个简单的测试应用程序.该应用程序使用MySQL 通过使用dblinq生成linq到MySQL文件,该应用程序就可以在Windows和Linux中正常工作.

I have written a simple test application using asp.net mvc with C#. The application uses MySQL by using dblinq to generate linq to MySQL files and the application is working both in windows and linux.

我现在开始使用NUnit来测试我的代码,主要是因为我需要测试代码是否在 Windows也将在linux中工作. 我的NUnit测试在Windows上运行良好,但在Linux下却无法运行.

I have now started to use NUnit to test my code, mostly since I need to test if the code working under windows also will work in linux. My NUnit tests runs well under Windows but not under Linux.

这是我的Windows环境:

This my Windows environment:

NUnit版本2.5.1.9189版权(C) 2002-2009查理·普尔(Charlie Poole).版权(C) 2002-2004詹姆斯·纽柯克(James W.Newkirk),迈克尔·C(Michael C. 版权所有(C)2000-2002 Philip Craig. 保留所有权利.

NUnit version 2.5.1.9189 Copyright (C) 2002-2009 Charlie Poole. Copyright (C) 2002-2004 James W. Newkirk, Michael C. Copyright (C) 2000-2002 Philip Craig. All Rights Reserved.

运行时环境-操作系统版本: Microsoft Windows NT 5.1.2600服务 CLR版本:2.0.50727.3053(Net 2.0.50727.3053)

Runtime Environment - OS Version: Microsoft Windows NT 5.1.2600 Service CLR Version: 2.0.50727.3053 ( Net 2.0.50727.3053 )

这是我的Linux环境,出现错误(库是我的应用程序名称):

This my Linux environment with the error (Library is my application name):

NUnit版本2.4.8版权(C) 2002-2007查理·普尔(Charlie Poole).版权(C) 2002-2004詹姆斯·纽柯克(James W.Newkirk),迈克尔·C(Michael C. 第二,Alexei A. Vorontsov.版权 (C)2000-2002菲利普·克雷格(Philip Craig).保留所有权利 保留.

NUnit version 2.4.8 Copyright (C) 2002-2007 Charlie Poole. Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov. Copyright (C) 2000-2002 Philip Craig. All Rights Reserved.

运行时环境-操作系统版本: Unix 2.6.24.24 CLR版本: 1.1.4322.2032(Mono 2.4.2.2)

Runtime Environment - OS Version: Unix 2.6.24.24 CLR Version: 1.1.4322.2032 ( Mono 2.4.2.2 )

**(/usr/local/lib/mono/1.0/nunit-console.exe:4888): 警告**:班级 System.ComponentModel.INotifyPropertyChanged 无法加载,无法在系统中使用, 版本= 2.0.0.0,文化=中性, PublicKeyToken = b77a5c561934e089文件 或程序集名称Library.Tests, 版本= 1.0.0.0,文化=中性, PublicKeyToken = null,或其其中之一 依赖项,未找到.

** (/usr/local/lib/mono/1.0/nunit-console.exe:4888): WARNING **: The class System.ComponentModel.INotifyPropertyChanged could not be loaded, used in System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 File or assembly name Library.Tests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null, or one of its dependencies, was not found.

我不知道自己在做什么错.你有什么建议吗?似乎我需要包含System.ComponentModel.INotifyPropertyChanged,我已经搜索过 在互联网上查看它是否以单声道实现,但我找不到任何信息. 谢谢

I can't figure out what I am doing wrong. Do you have any tips? It seems like I need to include System.ComponentModel.INotifyPropertyChanged, I have searched the Internet to see if it is implemented in mono but I can't find any information. Thank you

推荐答案

以某种方式启动了1.1 CLR-注意"CLR版本:1.1.4322.2032(Mono 2.4.2.2)"

Somehow you've started the 1.1 CLR - note "CLR Version: 1.1.4322.2032 ( Mono 2.4.2.2 )"

我不确定您是如何做到的,但是我很确定这就是问题所在……您究竟如何运行NUnit?我怀疑问题是您使用的是根据.NET 1.1编译的NUnit版本,因此Mono决定加载其自己的CLR v1.1.假设您要显式调用mono二进制文件,请尝试指定--runtime参数,如下所示:

I'm not sure how you've done that, but I'm pretty sure that's the problem... How exactly are you running NUnit? I suspect that the problem is you're using a version of NUnit compiled against .NET 1.1, so Mono decides to load its own CLR v1.1. Assuming you're explicitly calling the mono binary, try specifying the --runtime argument, like this:

mono --runtime=2.0.50727 (whatever you previously had here)

要找出您拥有的运行时版本,请尝试以下Test.cs文件:

To find out which runtime version you've got, try this Test.cs file:

using System;

class Test
{
    static void Main()
    {
        Console.WriteLine(Environment.Version);
    }
}

然后编译并运行它:

$ gmcs Test.cs
$ mono Test.exe
2.0.50727.1433

您从底部得到什么版本?

What version do you get out at the bottom?

这篇关于Nunit .net对比Mono的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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