在VB.Net中还有其他东西代替NUnit了吗? [英] Did Something Else Take The Place of NUnit as an Import in VB.Net?

查看:56
本文介绍了在VB.Net中还有其他东西代替NUnit了吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过Adar Wesley-Adar Wesley的Serializable Dictionary Code实现一个真正整洁的Serializable Dictionary例程.它最初是用C#编写的.我使用免费的Fusion Code Converter将其转换为VB.NET,并修复了转换后发现的一些问题.但是,我有一个难题,因为我应该在类中包含"Imports NUnit.Framework",以便Assert.IsNotNull(newDict,"Failed Desrializing")和Assert.AreEqual(dict.Count,newDict). Count)(如下面的代码片段所示)可以正常工作,但VB.NET似乎没有包含此类内容.我对导入完全不熟悉.谁能指出我正确的方向?有没有解决的办法?我不知道NUnit.Framework中包含哪些方法.

I''m attempting to implement a really neat Serializable Dictionary routine by Adar Wesley - Adar Wesley''s Serializable Dictionary Code. It was originally written in C#. I converted it to VB.NET using the free Fusion Code Converter and fixed a few problems that I recognized after the conversion. I have a dilemma however, in that I''m supposed to have "Imports NUnit.Framework" included in the class so that the Assert.IsNotNull(newDict, "Failed Desrializing") and Assert.AreEqual(dict.Count, newDict.Count), as shown in the code snippet below, work but VB.NET doesn''t seem to have such an inclusion. I''m not at all familiar with this import. Can anyone point me in the right direction? Is there a way around this? I haven''t a clue what methods are contained in NUnit.Framework.

'Test
       Public Sub SerializeDesrialize()
           Dim s As New XmlSerializer(GetType(SerializableDictionary(Of String, [MyClass])))
           Dim path As String = Environment.CurrentDirectory & "\SerializableDictionary.xml"
           Using sw As New StreamWriter(path)
               s.Serialize(sw, dict)
           End Using

           Dim newDict As SerializableDictionary(Of String, [MyClass]) = Nothing
           Using sr As New StreamReader(path)
               newDict = TryCast(s.Deserialize(sr), SerializableDictionary(Of String, [MyClass]))
           End Using

           Assert.IsNotNull(newDict, "Failed Desrializing")
           Assert.AreEqual(dict.Count, newDict.Count)
       End Sub

推荐答案

NUnit是用于单元测试的第三方库.它从未随.NET Framework或Visual Studio一起提供.

不需要测试代码即可运行代码.您可以删除所有测试代码,而没有它,该库的其余部分也可以正常工作.

或者,您可以获得 NUnit [
NUnit is a 3rd party library for unit testing. It never came with the .NET Framework or Visual Studio.

The testing code is not needed to run the code. You can remove all the testing code and the rest of the library will work fine without it.

Or, you can get NUnit[^] and install it.


这篇关于在VB.Net中还有其他东西代替NUnit了吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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