public async void Handler_Must_ThrowException(FindHandlerFixtures.TestTypeEnum testType, Type typeException) { // Arrange var fixture = new FindHandlerFixtures(testType); var query = fixture.Query; var sut = new FindHandlerFixtures.FindHandlerMock( fixture.ReadOnlyRepository.Object, fixture.Mapper.Object); // Act Exception ex = await Assert.ThrowsAnyAsync <Exception>(async() => await sut.Handle(query, default)); // Assert Assert.Equal(typeException, ex.GetType()); fixture.ReadOnlyRepository.VerifyAll(); fixture.ReadOnlyRepository.VerifyNoOtherCalls(); }
public async void Handler_MustReturn_Result() { // Arrange var fixture = new FindHandlerFixtures(FindHandlerFixtures.TestTypeEnum.Ok); var query = fixture.Query; var sut = new FindHandlerFixtures.FindHandlerMock( fixture.ReadOnlyRepository.Object, fixture.Mapper.Object); // Act var computed = await sut.Handle(query, default); // Assert Assert.NotNull(computed); Assert.Equal(fixture.QueryResult, computed); fixture.ReadOnlyRepository.VerifyAll(); fixture.ReadOnlyRepository.VerifyNoOtherCalls(); }