Esempio n. 1
0
        public async Task InvokeAsync_UnderTimeout_DoesntTimeoutOrThrowException()
        {
            var command = new ImmediatelyReturningCommandWithoutFallback();

            // Shouldn't throw exception.
            await command.InvokeAsync();
        }
Esempio n. 2
0
        public async Task InvokeAsync_Success()
        {
            var mockStats = new Mock<IStats>();
            var command = new ImmediatelyReturningCommandWithoutFallback
            {
                Stats = mockStats.Object,
            };

            await command.InvokeAsync();

            mockStats.Verify(m => m.Elapsed("mjolnir command test.ImmediatelyReturningCommandWithoutFallback total", "RanToCompletion", It.IsAny<TimeSpan>()), Times.Once);
            mockStats.Verify(m => m.Elapsed("mjolnir command test.ImmediatelyReturningCommandWithoutFallback execute", "RanToCompletion", It.IsAny<TimeSpan>()), Times.Once);
        }
Esempio n. 3
0
        public async Task InvokeAsync_Success()
        {
            var mockStats = new Mock <IStats>();
            var command   = new ImmediatelyReturningCommandWithoutFallback
            {
                Stats = mockStats.Object,
            };

            await command.InvokeAsync();

            mockStats.Verify(m => m.Elapsed("mjolnir command test.ImmediatelyReturningCommandWithoutFallback total", "RanToCompletion", It.IsAny <TimeSpan>()), Times.Once);
            mockStats.Verify(m => m.Elapsed("mjolnir command test.ImmediatelyReturningCommandWithoutFallback execute", "RanToCompletion", It.IsAny <TimeSpan>()), Times.Once);
        }
Esempio n. 4
0
        public async Task InvokeAsync_Success()
        {
            var mockStats = new Mock<IStats>();
            var mockMetricEvents = new Mock<IMetricEvents>();
            var command = new ImmediatelyReturningCommandWithoutFallback
            {
                Stats = mockStats.Object,
                MetricEvents = mockMetricEvents.Object,
            };

            await command.InvokeAsync();

            mockStats.Verify(m => m.Elapsed("mjolnir command test.ImmediatelyReturningCommandWithoutFallback total", "RanToCompletion", It.IsAny<TimeSpan>()), Times.Once);
            mockStats.Verify(m => m.Elapsed("mjolnir command test.ImmediatelyReturningCommandWithoutFallback execute", "RanToCompletion", It.IsAny<TimeSpan>()), Times.Once);
            mockMetricEvents.Verify(m => m.CommandInvoked("test.ImmediatelyReturningCommandWithoutFallback", It.IsAny<double>(), It.IsAny<double>(), "RanToCompletion", "throw"));
            mockMetricEvents.Verify(m => m.RejectedByBulkhead(It.IsAny<string>(), It.IsAny<string>()), Times.Never);
        }