Пример #1
0
        public void InputDoesMatter_WhenNoErrorsOccur_ExpectValidExecutionCount()
        {
            int count = 0;

            _preDefined
            .For(new { })
            .Check(x =>
            {
                count++;
                return(count == 1);
            }, () => new TestingFilteringError())
            .Apply(x =>
            {
                count++;
                return(x);
            })
            .Check(x =>
            {
                count++;
                return(count == 3);
            }, () => new TestingFilteringError())
            .Check(x =>
            {
                count++;
                return(new { prop = x });
            }, x =>
            {
                count++;
                return(count == 5);
            }, () => new TestingFilteringError())
            .Apply(x =>
            {
                count++;
                return(count == 6);
            })
            .Finalize(x =>
            {
                count++;
            })
            .Sink();
            Assert.Equal(7, count);
        }
Пример #2
0
        public void StandardFlow_WhenFinalize1ThrowsException_ExceptionReturned()
        {
            var(_, exception, _) = _builder
                                   .For(default(int))
                                   .Finalize(x =>
            {
                throw new Exception();
#pragma warning disable 162
                return(x);

#pragma warning restore 162
            })
                                   .Sink();

            Assert.NotNull(exception);
        }
Пример #3
0
 public void Flow_WhenValidationFails_ExpectSingleErrorInResult()
 {
     var(_, _, filteringErrors) = _builder
                                  .For(new { Msg = "Mockery" })
                                  .Check(x => false, () => new TestingFilteringError())
                                  .Finalize(Predefined.EmptyMethod)
                                  .Sink();
     Assert.Single(filteringErrors);
 }
Пример #4
0
 public void NewPipelineBuilder_ExpectPipelineReturned()
 {
     Assert.NotNull(_builder.For(new object()));
 }