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();
        }
        public void AddAssertionHandler(DialogAssertionServerEvent message, Action<TestExecutionMethodBeginClientEvent> onMatched)
        {
            var item = _notHandledYet.FirstOrDefault(begin => message.Message.Contains(GetItemToSearchFor(begin)));

            if(item ==  null)
            {
                _dialogAssertionEventsWithHandlers.Add(message, onMatched);
            }
            else
            {
                _notHandledYet.Remove(item);
                MarkItMatched(item, onMatched);
            }
        }
 public void Handle(DialogAssertionServerEvent message)
 {
     if (message == null) throw new ArgumentNullException("message");
     string writeMessage = message.Message;
     WriteServerEventFailure("DialogAssertionServerEvent", writeMessage);
 }
Esempio n. 4
0
 public void Handle(DialogAssertionServerEvent message)
 {
     if (message == null) throw new ArgumentNullException("message");
     WriteString(message.Message);
 }
 public void AddAssertionHandler(DialogAssertionServerEvent message, Action<TestExecutionMethodBeginClientEvent> onMatched)
 {
     _dialogAssertionEventsWithHandlers.Add(message, onMatched);
 }