public async Task ThrowsForQueryWithThrowSetupMatchingPredicateAsync() { // Arrange var queryProcessor = new FakeQueryProcessor(); queryProcessor.SetupExceptionFor <TestQueryB>(q => q.Number == 1337, new AbandonedMutexException()); // Act + Assert await Assert.ThrowsAsync <AbandonedMutexException>(async() => await queryProcessor.ExecuteAsync(new TestQueryB(1337))); }
public void ThrowsForQueryWithThrowSetupMatchingPredicate() { // Arrange var queryProcessor = new FakeQueryProcessor(); queryProcessor.SetupExceptionFor <TestQueryB>(q => q.Number == 1337, new AbandonedMutexException()); // Act + Assert Assert.Throws <AbandonedMutexException>(() => queryProcessor.Execute(new TestQueryB(1337))); }
public async Task DoesNotThrowIfQueryDoesntMatchPredicateAsync() { // Arrange var queryProcessor = new FakeQueryProcessor(); queryProcessor.SetupExceptionFor <TestQueryB>(q => q.Number == 1337, new AbandonedMutexException()); // Act var result = await queryProcessor.ExecuteAsync(new TestQueryB(9999)); // Assert result.ShouldBe(default(int)); }