public async Task ServiceCommand_Constructor_With_Async_Method_Args_Contains_Correct_Errors_On_Failure()
        {
            var command = new ServiceCommand <Person>(
                executeAsyncMethod: () => Task.Run(() => new Person()),
                getBusinessRulesAsyncMethod: () => Task.Run <IEnumerable <IRule> >(() => new [] { new FalseRule1() })
                );
            var result = await command.ExecuteAsync();

            result.Errors.First().ErrorMessage.ShouldBe("FalseRule1 failed validation");
        }
        public async Task ServiceCommandOfT_Composition_6()
        {
            var command = new ServiceCommand <Person>
                          (
                executeAsyncMethod
                          );

            await command.ExecuteAsync();

            _count.ShouldBe("4");
        }
        public async Task ServiceCommandOfT_Composition_2()
        {
            var command = new ServiceCommand <Person>
                          (
                initializationAsyncMethod,
                executeAsyncMethod
                          );

            await command.ExecuteAsync();

            _count.ShouldBe("14");
        }
        public async Task ServiceCommandOfT_Composition_9()
        {
            var command = new ServiceCommand <Person>
                          (
                getBusinessRulesAsyncMethod,
                executeAsyncMethod
                          );

            await command.ExecuteAsync();

            _count.ShouldBe("34");
        }
Exemple #5
0
        public async Task ServiceCommand_Composition_5()
        {
            var command = new ServiceCommand
                          (
                validationAsyncMethod,
                executeAsyncMethod
                          );

            await command.ExecuteAsync();

            _count.ShouldBe("24");
        }
        public async Task ServiceCommand_Composition_11()
        {
            var command = new ServiceCommand
                          (
                executeAsyncMethod
                          );

            command.Execute();
            await command.ExecuteAsync();

            _count.ShouldBe("4");
        }
Exemple #7
0
        public async Task ServiceCommand_Composition_13()
        {
            var command = new ServiceCommand
                          (
                initializationAsyncMethod,
                getBusinessRulesAsyncMethod,
                executeAsyncMethod
                          );

            await command.ExecuteAsync();

            _count.ShouldBe("134");
        }
        public async Task ServiceCommand_Composition_12()
        {
            var command = new ServiceCommand
                          (
                executeAsyncMethod,
                getBusinessRulesAsyncMethod
                          );

            command.Execute();
            await command.ExecuteAsync();

            _count.ShouldBe("34");
        }
        public async Task ServiceCommand_Composition_7()
        {
            var command = new ServiceCommand
                          (
                executeMethod,
                getErrorsMethod
                          );

            command.Execute();
            await command.ExecuteAsync();

            _count.ShouldBe("24");
        }
        public async Task ServiceCommand_Composition_3()
        {
            var command = new ServiceCommand
                          (
                initializationMethod,
                executeMethod
                          );

            command.Execute();
            await command.ExecuteAsync();

            _count.ShouldBe("14");
        }
        public async Task ServiceCommandOfT_Composition_15()
        {
            var command = new ServiceCommand <Person>
                          (
                initializationAsyncMethod,
                validationAsyncMethod,
                getBusinessRulesAsyncMethod,
                executeAsyncMethod
                          );

            await command.ExecuteAsync();

            _count.ShouldBe("124");
        }
Exemple #12
0
        public async Task ServiceCommand_Composition_14()
        {
            var command = new ServiceCommand
                          (
                initializationAsyncMethod,
                executeAsyncMethod,
                getErrorsAsyncMethod
                          );

            command.Execute();
            await command.ExecuteAsync();

            _count.ShouldBe("124");
        }
Exemple #13
0
        public async Task ServiceCommandConstructorWithAsyncAndSyncMethodArgsContainsCorrectErrorsOnFailure()
        {
            var command = new ServiceCommand <Person>(
                executeMethod: () => new Person(),
                executeAsyncMethod: () => Task.Run(() => new Person()),
                getBusinessRulesMethod: () => new[] { new FalseRule1() },
                getBusinessRulesAsyncMethod: () => Task.Run <IEnumerable <IRule> >(() => new [] { new FalseRule2() })
                );

            command.Execute().Errors.First().ErrorMessage.ShouldBe("FalseRule1 failed validation");
            var result = await command.ExecuteAsync();

            result.Errors.First().ErrorMessage.ShouldBe("FalseRule2 failed validation");
        }
Exemple #14
0
        public async Task ServiceCommandOfT_Composition_5()
        {
            var command = new ServiceCommand <Person>
                          (
                getErrorsMethod,
                getErrorsAsyncMethod,
                executeMethod,
                executeAsyncMethod
                          );

            command.Execute();
            await command.ExecuteAsync();

            _count.ShouldBe("2424");
        }