Ejemplo n.º 1
0
        public void If_assettion_happens_before_begin_test_event_arrives_should_match()
        {
            var testExecutionMethodBeginClientEvent = new TestExecutionMethodBeginClientEvent
            {
                NamespaceName = "a",
                ClassName     = "b",
                MethodName    = "c",
            };
            var dialogAssertionServerEvent = new DialogAssertionServerEvent(DialogType.Assert)
            {
                Message = "at b.c",
            };
            var dialogAssertionMatchmaker = new DialogAssertionMatchmaker();
            var testExecutionMethod       = new TestExecutionMethodPassedClientEvent
            {
                NamespaceName = "a",
                ClassName     = "b",
                MethodName    = "c",
            };
            bool match = false;


            dialogAssertionMatchmaker.AddAssertionHandler(dialogAssertionServerEvent, item =>
            {
                match = true;
            });
            dialogAssertionMatchmaker.HandleMethodBeginClientEvent(testExecutionMethodBeginClientEvent);


            dialogAssertionMatchmaker.WasEventAlreadyClosed(testExecutionMethod).ShouldBeTrue();
            match.ShouldBeTrue();
        }
        public void Should_detect_assertion()
        {
            var testExecutionMethodBeginClientEvent = new TestExecutionMethodBeginClientEvent
                                                          {
                                                              NamespaceName = "a",
                                                              ClassName = "b",
                                                              MethodName = "c",
                                                          };
            var dialogAssertionServerEvent = new DialogAssertionServerEvent(DialogType.Assert)
                                                 {
                                                     Message = "at b.c",
                                                 };
            var dialogAssertionMatchmaker = new DialogAssertionMatchmaker();
            var testExecutionMethod = new TestExecutionMethodPassedClientEvent
                                          {
                                              NamespaceName = "a",
                                              ClassName = "b",
                                              MethodName = "c",
                                          };
            bool match = false;

            dialogAssertionMatchmaker.HandleMethodBeginClientEvent(testExecutionMethodBeginClientEvent);
            dialogAssertionMatchmaker.AddAssertionHandler(dialogAssertionServerEvent, item =>
            {
                match = true;
            });

            dialogAssertionMatchmaker.WasEventAlreadyClosed(testExecutionMethod).ShouldBeTrue();
            match.ShouldBeTrue();
        }
Ejemplo n.º 3
0
        private static void SendTestPassedClientEvent(MethodInfo method)
        {
            var passedClientEvent = new TestExecutionMethodPassedClientEvent
            {
                Started  = new DateTime(),
                Finished = new DateTime(),
            };
            var e = PopulateCoreInfo(passedClientEvent, method);

            Server.PostMessage(e);
        }
Ejemplo n.º 4
0
            protected override void Before_all_tests()
            {
                base.Before_all_tests();

                _testExecutionMethodPassedClientEvent = new TestExecutionMethodPassedClientEvent()
                {
                    ClassName     = "Class name test",
                    MethodName    = "method name test",
                    NamespaceName = "namespace test",
                    Finished      = new DateTime(2009, 1, 1, 1, 1, 1),
                    Started       = new DateTime(2009, 1, 1, 1, 1, 2),
                };
            }
            protected override void Before_all_tests()
            {
                base.Before_all_tests();

                _testExecutionMethodPassedClientEvent = new TestExecutionMethodPassedClientEvent()
                {
                    ClassName = "Class name test",
                    MethodName = "method name test",
                    NamespaceName = "namespace test",
                    Finished = new DateTime(2009, 1, 1, 1, 1, 1),
                    Started = new DateTime(2009, 1, 1, 1, 1, 2),
                };
            }
        public ClientEvent Translate(LogMessage message)
        {
            var scenarioResult = (ScenarioResult)message.Decorators[UnitTestLogDecorator.ScenarioResult];
            var testMethod     = (ITestMethod)message.Decorators[UnitTestLogDecorator.TestMethodMetadata];

            var clientEventX = new TestExecutionMethodPassedClientEvent
            {
                Finished = scenarioResult.Finished,
                Started  = scenarioResult.Started,
            };

            clientEventX.AssignTestExecutionMethodInfo(testMethod);
            return(clientEventX);
        }