public async Task InvokeAsync_ExecuteFaultsAndNoFallback_ThrowsCommandException()
        {
            var command = new FaultingExecuteWithoutFallbackCommand();
            try
            {
                await command.InvokeAsync();
            }
            catch (CommandFailedException)
            {
                return; // Expected.
            }

            AssertX.FailExpectedException();
        }
Example #2
0
        public async Task InvokeAsync_ExecuteFaultsAndNoFallback_ThrowsCommandException()
        {
            var command = new FaultingExecuteWithoutFallbackCommand();

            try
            {
                await command.InvokeAsync();
            }
            catch (CommandFailedException)
            {
                return; // Expected.
            }

            AssertX.FailExpectedException();
        }
Example #3
0
        public async Task InvokeAsync_GeneralExceptionFromExecute()
        {
            var mockStats = new Mock<IStats>();
            var command = new FaultingExecuteWithoutFallbackCommand
            {
                Stats = mockStats.Object
            };

            try
            {
                await command.InvokeAsync();
            }
            catch (CommandFailedException)
            {
                mockStats.Verify(m => m.Elapsed("mjolnir command test.FaultingExecuteWithoutFallback total", "Faulted", It.IsAny<TimeSpan>()), Times.Once);
                mockStats.Verify(m => m.Elapsed("mjolnir command test.FaultingExecuteWithoutFallback execute", "Faulted", It.IsAny<TimeSpan>()), Times.Once);
                return; // Expected.
            }

            AssertX.FailExpectedException();
        }
Example #4
0
        public async Task InvokeAsync_GeneralExceptionFromExecute()
        {
            var mockStats = new Mock <IStats>();
            var command   = new FaultingExecuteWithoutFallbackCommand
            {
                Stats = mockStats.Object
            };

            try
            {
                await command.InvokeAsync();
            }
            catch (CommandFailedException)
            {
                mockStats.Verify(m => m.Elapsed("mjolnir command test.FaultingExecuteWithoutFallback total", "Faulted", It.IsAny <TimeSpan>()), Times.Once);
                mockStats.Verify(m => m.Elapsed("mjolnir command test.FaultingExecuteWithoutFallback execute", "Faulted", It.IsAny <TimeSpan>()), Times.Once);
                return; // Expected.
            }

            AssertX.FailExpectedException();
        }
Example #5
0
 public async Task InvokeAsync_ExecuteFaultsAndNoFallback_ThrowsCommandException()
 {
     var command = new FaultingExecuteWithoutFallbackCommand();
     await Assert.ThrowsAsync<CommandFailedException>(() => command.InvokeAsync());
 }