Esempio n. 1
0
        public async Task Run_ReturnsPending()
        {
            // Arrange
            Func <ShouldRunTestResult> shouldRun = () => ShouldRunTestResult.RetryLater;
            Action runInternal = () => { };

            var validator = new TestableValidator(shouldRun, runInternal);

            var context = CreateContext();

            // Act
            var result = await validator.ValidateAsync(context);

            // Assert
            Assert.Same(validator, result.Validator);
            Assert.Equal(TestResult.Pending, result.Result);
            Assert.Null(result.Exception);
        }
Esempio n. 2
0
        public async Task Run_ReturnsFail()
        {
            // Arrange
            var exception = new Exception();

            Func <ShouldRunTestResult> shouldRun = () => ShouldRunTestResult.Yes;
            Action runInternal = () => { throw exception; };

            var validator = new TestableValidator(shouldRun, runInternal);

            var context = CreateContext();

            // Act
            var result = await validator.ValidateAsync(context);

            // Assert
            Assert.Same(validator, result.Validator);
            Assert.Equal(TestResult.Fail, result.Result);
            Assert.Same(exception, result.Exception);
        }