Skip to content

Commit

Permalink
Add unit tests for prevention of null properties
Browse files Browse the repository at this point in the history
  • Loading branch information
dynamictulip committed Oct 11, 2023
1 parent bf7f364 commit d9140cb
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,39 @@ public async Task SearchAsync_should_only_return_single_and_multi_academy_trusts
result.Should().HaveCount(2);
}

[Fact]
public async Task SearchAsync_should_not_return_groups_with_a_null_GroupUid()
{
var groups = SetupMockDbContextGroups(5);

groups[0].GroupUid = null;

var result = await _sut.SearchAsync("trust");
result.Should().HaveCount(4);
}

[Fact]
public async Task SearchAsync_should_not_return_groups_with_a_null_GroupId()
{
var groups = SetupMockDbContextGroups(5);

groups[0].GroupId = null;

var result = await _sut.SearchAsync("trust");
result.Should().HaveCount(4);
}

[Fact]
public async Task SearchAsync_should_not_return_groups_with_a_null_GroupName()
{
var groups = SetupMockDbContextGroups(5);

groups[0].GroupName = null;

var result = await _sut.SearchAsync("trust");
result.Should().HaveCount(4);
}

private List<Group> SetupMockDbContextGroups(int numMatches)
{
var groups = new List<Group>();
Expand Down

0 comments on commit d9140cb

Please sign in to comment.