Skip to content

Commit 977395a

Browse files
committed
use base test class, remove redundant brackets
1 parent 422a685 commit 977395a

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Reverse-Analytics/Tests/ReverseAnalytics.Tests.Unit/Architecture/ConstructorsFixture.cs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
namespace ReverseAnalytics.Tests.Unit.Architecture;
22

3-
public class ConstructorsFixture
3+
public class ConstructorsFixture : ArchitectureTestsBase
44
{
55
[Fact]
66
public void ConstructorsOfAllControllers_ShouldThrowArgumentNullException_WhenAnyParameterIsNull()
77
{
88
// Arrange
9-
var constructors = typeof(ProductCategoryController).Assembly
9+
var constructors = Types.InAssembly(DomainAssembly)
1010
.GetTypes()
1111
.Where(t => t.Namespace is not null && t.Namespace.Contains("Controllers"))
12+
.Where(t => t.IsAssignableTo(typeof(ControllerBase)))
1213
.SelectMany(t => t.GetConstructors())
13-
.Where(t => t.GetParameters().Length > 0)
14+
.Where(c => c.GetParameters().Length > 0)
1415
.ToList();
1516

1617
// Act & Assert

Reverse-Analytics/Tests/ReverseAnalytics.Tests.Unit/Controllers/ProductCategoryControllerFixture.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public async Task GetCategoriesAsync_ShouldReturnAllCategories_WhenCalled()
4242

4343
// Assert
4444
okResult.Should().NotBeNull();
45-
okResult!.StatusCode.Should().Be(((int)HttpStatusCode.OK));
45+
okResult!.StatusCode.Should().Be((int)HttpStatusCode.OK);
4646
okResult!.Value.Should().BeAssignableTo<IEnumerable<ProductCategoryDto>>();
4747
okResult!.Value.Should().BeEquivalentTo(paginatedCategories);
4848
}

0 commit comments

Comments
 (0)