Marks a test method.
xUnit.net does not require an attribute for a test class; it looks for all test methods in all public (exported) classes in the assembly.
Assert.Throws
Record.Exception
xUnit.net has done away with the ExpectedException attribute in favor of Assert.Throws.
We believe that use of [SetUp]is generally bad. However, you can implement a parameterless constructor as a direct replacement.
We believe that use of[TearDown] is generally bad. However, you can implementIDisposable.Dispose as a direct replacement.
To get per-fixture setup, implement IUseFixture<T> on your test class.
To get per-fixture teardown, implement IUseFixture<T> on your test class.
Set the Skip parameter on the[Fact] attribute to temporarily skip a test.
Set the Timeout parameter on the [Fact] attribute to cause a test to fail if it takes too long to run. Note that the timeout value for xUnit.net is in milliseconds.
[Category]
Set arbitrary metadata on a test
Theory (data-driven test).
MSTest and xUnit.net support generic versions of this method
NotSame
Same
Contains
(on CollectionAssert)
n/a
DoesNotContain
Ensures that the code does not throw any exceptions
xUnit.net alternative:
Assert.True(false, "message")
Assert.True(x > y)
GreaterOrEqual
Ensures that a value is in a given inclusive range (note: NUnit and MSTest have limited support for InRange on their AreEqual methods)
IsAssignableFrom
Empty
False
IsType
Assert.True(double.IsNaN(x))
Assert.False(obj is Type);
NotEmpty
IsNotType
NotNull
Null
True
Assert.True(x < y)
LessOrEqual
NotInRange
Ensures that a value is not in a given inclusive range
Ensures that the code throws an exact exception
参考资料
出处:https://www.cnblogs.com/gaochundong/p/mstest_nunit_xunit_comparisons.html
您的资助是我最大的动力!金额随意,欢迎来赏! 付款后有任何问题请给我留言。
如果,您认为阅读这篇博客让您有些收获,不妨点击一下右下角的【推荐】按钮。 如果,您希望更容易地发现我的新博客,不妨点击一下绿色通道的【关注我】。(●'◡'●)
因为,我的写作热情也离不开您的肯定与支持,感谢您的阅读,我是【Jack_孟】!
本文来自博客园,作者:jack_Meng,转载请注明原文链接:https://www.cnblogs.com/mq0036/p/15400859.html
【免责声明】本文来自源于网络,如涉及版权或侵权问题,请及时联系我们,我们将第一时间删除或更改!
posted on 2021-10-13 10:06 jack_Meng 阅读(157) 评论(0) 编辑 收藏 举报
Zero vs Master (No.18)
导出pdf后,为什么打不开。 不支持打开该类型文件或文件已损坏。文件名:“思维导图课程.pdf”
博主选的BGM太上头了
给大佬点赞、想问下device_list接口是不是无法获取共享家庭中的设备?
Mark
能不能想办法支持SAP HANA数据库?
学到了,感谢
扫描二维码打赏
支付宝打赏
了解更多
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 没有源码,如何修改代码逻辑?
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
· [.NET]调用本地 Deepseek 模型
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· .NET Core 托管堆内存泄露/CPU异常的常见思路
· DeepSeek “源神”启动!「GitHub 热点速览」
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· C# 集成 DeepSeek 模型实现 AI 私有化(本地部署与 API 调用教程)
· DeepSeek R1 简明指南:架构、训练、本地部署及硬件要求
· NetPad:一个.NET开源、跨平台的C#编辑器
2020-10-13 bat中如何处理参数(文件路径)的引号