Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed nulls for Success result #119

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/NetArchTest.Rules/TestResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ public IReadOnlyList<string> FailingTypeNames
internal static TestResult Success()
=> new TestResult
{
IsSuccessful = true
IsSuccessful = true,
_failingTypes = new List<TypeDefinition>(0),
};

/// <summary>
Expand Down
7 changes: 4 additions & 3 deletions test/NetArchTest.Rules.UnitTests/ConditionListTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ public void GetResult_FailedShouldNot_ReturnFailedTypes()
Assert.Contains<Type>(typeof(ClassA3), result.FailingTypes);
}

[Fact(DisplayName = "If a condition succeeds then a list of failing types should be null.")]
public void GetResult_Success_ReturnNullFailedTypes()
[Fact(DisplayName = "If a condition succeeds then a list of failing types should be empty.")]
public void GetResult_Success_ReturnEmptyFailedTypes()
{
var result = Types
.InAssembly(Assembly.GetAssembly(typeof(ClassA1)))
Expand All @@ -161,7 +161,8 @@ public void GetResult_Success_ReturnNullFailedTypes()
.GetResult();

Assert.True(result.IsSuccessful);
Assert.Null(result.FailingTypes);
Assert.NotNull(result.FailingTypes);
Assert.Empty(result.FailingTypes);
}
}
}