예제 #1
0
        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)));
        }
예제 #2
0
        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)));
        }
예제 #3
0
        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));
        }