public async Task Should_Get_Account_Index_With_Filter() { _fixture.StartScope(); { // Arrange-TestAccountList var request = new Create.Request { Email = "*****@*****.**", Password = Guid.NewGuid().ToString() }; await _fixture.SendAsync(request); request.Email = "*****@*****.**"; await _fixture.SendAsync(request); request.Email = "*****@*****.**"; await _fixture.SendAsync(request); // Act var count = await _fixture.CountAsync <Account>(); // Assert // There is also an AdminAccount Assert.Equal(3 + 1, count); } { // Single Result Test // Arrange var request = new Index.Request { Filter = "Email eq '*****@*****.**'" }; // Act var response = await _fixture.SendAsync(request); // Assert Assert.NotNull(response); Assert.Single(response.Items); Assert.Equal("*****@*****.**", response.Items.First().Email); } { // Multiple Result Test // Arrange var request = new Index.Request { Filter = "Role eq 'RegularUser'" }; // Act var response = await _fixture.SendAsync(request); // Assert Assert.NotNull(response); Assert.Equal(3, response.Items.Count); Assert.Equal("*****@*****.**", response.Items.First().Email); } }
public async Task Should_Get_Account_Index_Without_Filter() { _fixture.StartScope(); { // Arrange-TestAccountList var request = new Create.Request { Email = "*****@*****.**", Password = Guid.NewGuid().ToString() }; await _fixture.SendAsync(request); request.Email = "*****@*****.**"; await _fixture.SendAsync(request); request.Email = "*****@*****.**"; await _fixture.SendAsync(request); // Act var count = await _fixture.CountAsync <Account>(); // Assert // There is also an AdminAccount Assert.Equal(3 + 1, count); } { // Arrange var request = new Index.Request { PageSize = 100 }; // Act var response = await _fixture.SendAsync(request); // Assert Assert.NotNull(response); Assert.Equal(4, response.Items.Count); } }