C# 单元测试无法在TestClass定义的类上运行
我有一门考试课:C# 单元测试无法在TestClass定义的类上运行,c#,unit-testing,resharper,C#,Unit Testing,Resharper,我有一门考试课: [TestClass] class DocumentStoreProviderTests : TestBase { [TestMethod, TestCategory(Unit)] public void DocumentProvider_AssertEntityToCreateIsValid_Fail_When_DocumentNameIsEmpty() { // arrange var scope = new Defa
[TestClass]
class DocumentStoreProviderTests : TestBase
{
[TestMethod, TestCategory(Unit)]
public void DocumentProvider_AssertEntityToCreateIsValid_Fail_When_DocumentNameIsEmpty()
{
// arrange
var scope = new DefaultScope();
var invalidUpdateEntity = Builder<Dom.Document>
.CreateNew()
.With(x => x.Name, string.Empty)
.Build();
//act
Action methodUnderTest = () => scope.InstanceUnderTest.AssertEntityToCreateIsValidAsync(invalidUpdateEntity).GetAwaiter().GetResult();
//Assert
methodUnderTest.ShouldThrow<BusinessValidationException>();
}
}
我正在使用resharper运行单元测试,我的所有其他测试文件都运行良好
我做错了什么以及如何修复它?将类DocumentStoreProviderTests和TestBase公开。将类DocumentStoreProviderTests和TestBase公开。TestCategory(“单元”)应该修复它。它匹配一个作为类别名称的字符串。TestCategory(“Unit”)应该修复它。它匹配一个作为类别名称的字符串。删除TestCategory装饰器时会发生什么?那么它能工作吗?@Dudemanword同样的问题。当你移除TestCategory装饰器时会发生什么?“那它行得通吗?”杜德曼说,同样的问题。
========== Discover test finished: 1090 found (0:00:02.8716539) ==========
No tests found to run.