Esempio n. 1
0
        public void Errors_from_the_execution_do_not_bubble_out_when_asserting_the_execution_order()
        {
            var operation = new FakeOperation {
                ThrowOnExecute = new Exception()
            };

            Assert.Throws <AssertionException>(() => operation.ExecutesChildOperations(typeof(Operation1)));
        }
Esempio n. 2
0
        public void You_can_verify_that_executing_an_operation_has_executed_a_specific_sequence_of_child_operations_even_though_an_operation_fails()
        {
            var operation = new FakeOperation(new FakeOperation {
                ThrowOnExecute = new Exception()
            });

            operation.ExecutesChildOperations(typeof(FakeOperation));
        }
        public void Asserting_a_sequence_of_child_operation_executions_highlight_when_there_are_too_few_operations_executed()
        {
            var operation = new FakeOperation(new Operation1(), new FakeOperation());
            AssertionException exception = null;

            try { operation.ExecutesChildOperations(typeof(Operation1), typeof(FakeOperation), typeof(Operation2)); }
            catch (AssertionException e) { exception = e; }

            var formattedErrorMessage = string.Format("Operations{0}=========={0}Operation1 [match]{0}FakeOperation [match]{0}none [error: expected Operation2]", NL);
            Assert.Equal(formattedErrorMessage, exception.Message);
        }
Esempio n. 4
0
        public void Asserting_a_sequence_of_child_operation_executions_highlight_matches_after_errors()
        {
            var operation = new FakeOperation(new Operation1(), new FakeOperation(new Operation1()), new Operation1());
            AssertionException exception = null;

            try { operation.ExecutesChildOperations(typeof(Operation1), typeof(FakeOperation), typeof(Operation2), typeof(Operation1)); }
            catch (AssertionException e) { exception = e; }

            var formattedErrorMessage = string.Format("Operations{0}=========={0}Operation1 [match]{0}FakeOperation [match]{0}Operation1 [error: expected Operation2]{0}Operation1 [match]", NL);

            Assert.Equal(formattedErrorMessage, exception.Message);
        }
Esempio n. 5
0
        public void You_get_an_assertion_exception_thrown_when_asserting_that_executing_an_operation_has_executed_a_specific_sequence_of_child_operations_when_it_has_not()
        {
            var operation = new FakeOperation(new FakeOperation(new Operation2()), new Operation1());

            Assert.Throws <AssertionException>(() => operation.ExecutesChildOperations(typeof(Operation1), typeof(FakeOperation), typeof(Operation2)));
        }
Esempio n. 6
0
        public void You_can_verify_that_executing_an_operation_has_executed_a_specific_sequence_of_child_operations_when_operations_have_behaviors()
        {
            var operation = new FakeOperation(new Operation1(), new FakeOperationBehavior().AttachTo(new FakeOperation(new Operation2())));

            operation.ExecutesChildOperations(typeof(Operation1), typeof(FakeOperation), typeof(Operation2));
        }
        public void You_can_verify_that_executing_an_operation_has_executed_a_specific_sequence_of_child_operations_even_though_an_operation_fails()
        {
            var operation = new FakeOperation(new FakeOperation { ThrowOnExecute = new Exception() });

            operation.ExecutesChildOperations(typeof(FakeOperation));
        }
        public void Errors_from_the_execution_do_not_bubble_out_when_asserting_the_execution_order()
        {
            var operation = new FakeOperation{ ThrowOnExecute = new Exception() };

            Assert.Throws<AssertionException>(() => operation.ExecutesChildOperations(typeof (Operation1)));
        }
        public void You_get_an_assertion_exception_thrown_when_asserting_that_executing_an_operation_has_executed_a_specific_sequence_of_child_operations_when_it_has_not()
        {
            var operation = new FakeOperation(new FakeOperation(new Operation2()), new Operation1());

            Assert.Throws<AssertionException>(() => operation.ExecutesChildOperations(typeof (Operation1), typeof (FakeOperation), typeof (Operation2)));
        }
        public void You_can_verify_that_executing_an_operation_has_executed_a_specific_sequence_of_child_operations()
        {
            var operation = new FakeOperation(new Operation1(), new FakeOperation(new Operation2()));

            operation.ExecutesChildOperations(typeof(Operation1), typeof(FakeOperation), typeof(Operation2));
        }