コード例 #1
0
        public async Task ExecuteFuncTest()
        {
            // Arrange
            var config = new CodeConfiguration();

            // Act
            var result = await config.ExecuteAsync(() => true);

            // Assert
            Assert.True(result);
        }
コード例 #2
0
        public async Task ExecuteActionTest()
        {
            // Arrange
            var config = new CodeConfiguration();
            var num    = 0;

            // Act
            await config.ExecuteAsync(() => { num++; });

            // Assert
            Assert.AreEqual(1, num);
        }
コード例 #3
0
        public async Task ExecuteActionTest()
        {
            // Arrange
            var config = new CodeConfiguration();
            var num = 0;

            // Act
            await config.ExecuteAsync(() => { num++; });

            // Assert
            Assert.AreEqual(1, num);
        }
コード例 #4
0
        public async Task ExecuteFuncAsyncTest()
        {
            // Arrange
            var config = new CodeConfiguration();

            // Act
            var result = await config.ExecuteAsync(async() =>
            {
                await Task.Yield();
                return(true);
            });

            // Assert
            Assert.True(result);
        }
コード例 #5
0
        public async Task ExecuteActionRetryTest()
        {
            // Arrange
            var config = new CodeConfiguration();
            var num    = 0;
            // Act
            await config.ExecuteAsync(() =>
            {
                num++;
                throw new Exception();
            }, e =>
            {
                num++;
            });

            // Assert
            Assert.AreEqual(4, num);
        }
コード例 #6
0
        public async Task ExecuteActionRetryTest()
        {
            // Arrange
            var config = new CodeConfiguration();
            var num = 0;
            // Act
            await config.ExecuteAsync(() =>
            {
                num++;
                throw new Exception();
            }, e =>
            {
                num++;
            });

            // Assert
            Assert.AreEqual(4, num);
        }
コード例 #7
0
        public async Task ExecuteFuncRetryTest()
        {
            // Arrange
            var config = new CodeConfiguration();
            var num    = 0;
            // Act
            var actual = await config.ExecuteAsync(() =>
            {
                num++;
                throw new Exception();
            }, e =>
            {
                num++;
                return(num);
            });

            // Assert
            Assert.AreEqual(4, actual);
        }
コード例 #8
0
        public async Task ExecuteFuncRetryTest()
        {
            // Arrange
            var config = new CodeConfiguration();
            var num = 0;
            // Act
            var actual = await config.ExecuteAsync(() =>
            {
                num++;
                throw new Exception();
            }, e =>
            {
                num++;
                return num;
            });

            // Assert
            Assert.AreEqual(4, actual);
        }
コード例 #9
0
        public async Task ExecuteFuncAsyncTest()
        {
            // Arrange
            var config = new CodeConfiguration();

            // Act
            var result = await config.ExecuteAsync(async () =>
            {
                await Task.Yield();
                return true;
            });

            // Assert
            Assert.True(result);
        }
コード例 #10
0
        public async Task ExecuteFuncTest()
        {
            // Arrange
            var config = new CodeConfiguration();

            // Act
            var result = await config.ExecuteAsync(() => true);

            // Assert
            Assert.True(result);
        }