public void it_can_run_a_func_with_five_args()
        {
            var context = new CorrelationContext();

            var i = context.Run((v, w, x, y, z) => v + w + x + y + z, 1, 1, 1, 1, 1);

            Assert.True(i == 5,
                        $"Expected i to be 1 (the sum of args) but had <{i}>");
        }
Ejemplo n.º 2
0
        public void you_can_run_a_func_which_returns_something_with_it()
        {
            var context = new CorrelationContext();

            var result = context.Run(() => 1);

            Assert.True(result == 1,
                        $"Expected result to have the value 1 (because it was returned) but was <{result}>");
        }
        public void it_can_run_a_func_with_one_arg()
        {
            var context = new CorrelationContext();

            var i = context.Run(x => x, 1);

            Assert.True(i == 1,
                        $"Expected i to be 1 (the sum of args) but had <{i}>");
        }
        public void it_can_run_a_func_with_three_args()
        {
            var context = new CorrelationContext();

            var i = context.Run((x, y, z) => x + y + z, 1, 1, 1);

            Assert.True(i == 3,
                        $"Expected i to be 3 (the sum of args) but had <{i}>");
        }
        public void a_functions_result_can_be_annotated_with_timing()
        {
            var context = new CorrelationContext();

            var annotatedResult =
                context.Run(x => { Thread.Sleep(1000); return(x); }, "whereyouat");

            Assert.InRange(annotatedResult.TimeElapsed, 800, 1200);
        }
Ejemplo n.º 6
0
        public void you_can_run_an_action_that_returns_nothing_with_it()
        {
            var context = new CorrelationContext();
            var x       = 1;

            context.Run(() => x += 1);

            Assert.True(x == 2,
                        $"Expected x to have the value 2 (because it was updated) but was <{x}>");
        }
        public void it_can_run_an_action_with_one_arg()
        {
            var context = new CorrelationContext();
            var i       = 0;

            context.Run(x => i += x, 1);

            Assert.True(i == 1,
                        $"Expected x to have the value 2 (because it was updated) but was <{i}>");
        }
        public void it_can_run_an_action_with_five_args()
        {
            var context = new CorrelationContext();
            var i       = 0;

            context.Run((v, w, x, y, z) => i += v + w + x + y + z, 1, 1, 1, 1, 1);

            Assert.True(i == 5,
                        $"Expected x to have the value 5 (because it was updated) but was <{i}>");
        }
        public void it_can_run_an_action_with_two_args()
        {
            var context = new CorrelationContext();
            var i       = 0;

            context.Run((x, y) => i += x + y, 1, 1);

            Assert.True(i == 2,
                        $"Expected x to have the value 3 (because it was updated) but was <{i}>");
        }