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 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 HandleMethodBeginClientEvent(TestExecutionMethodBeginClientEvent message) { if (_dialogAssertionEventsWithHandlers.Any(w => w.Key.Message.Contains(message.MethodName))) { var x = _dialogAssertionEventsWithHandlers.First(w => w.Key.Message.Contains(message.MethodName)); _completedMessage.Add(message); x.Value(message); } }
public void Handle(TestExecutionMethodBeginClientEvent message) { // TODO: For some reason this is triggered AFTER the method is run, so the test timings are incorrect var testMethod = GetTestMethod(message.FullMethodName); if (testMethod != null) { testMethod.Node.NotifyStarting(); } }
public ClientEvent Translate(LogMessage message) { var testMethod = (ITestMethod)message.Decorators[UnitTestLogDecorator.TestMethodMetadata]; var clientEventX = new TestExecutionMethodBeginClientEvent { Started = DateTime.Now, }; clientEventX.AssignTestExecutionMethodInfo(testMethod); return(clientEventX); }
public void HandleMethodBeginClientEvent(TestExecutionMethodBeginClientEvent message) { var searchFor = GetItemToSearchFor(message); if (_dialogAssertionEventsWithHandlers.Any(w => w.Key.Message.Contains(searchFor))) { var x = _dialogAssertionEventsWithHandlers.First(w => w.Key.Message.Contains(searchFor)); MarkItMatched(message, x.Value); } else { _notHandledYet.Add(message); } }
public void AddBeginEvent(TestExecutionMethodBeginClientEvent clientEvent) { lock (_sync) { if (_awaitingForAMatch.ContainsKey(clientEvent.FullMethodName)) { Action a = _awaitingForAMatch[clientEvent.FullMethodName]; if (a != null) { a(); } _awaitingForAMatch.Remove(clientEvent.FullMethodName); } else { _awaitingForAMatch.Add(clientEvent.FullMethodName, null); } } }
public void Handle(TestExecutionMethodBeginClientEvent message) { if (message == null) { throw new ArgumentNullException("message"); } if (_beginEventsAlreadyFired.Contains(message.FullMethodName.GetHashCode())) { _logger.Debug(message.WriteDebug()); return; } _beginEventsAlreadyFired.Add(message.FullMethodName.GetHashCode()); //_logger.Debug("Handle - TestExecutionMethodBeginClientEvent - {0}".FormatWith(message.FullMethodName)); _dialogAssertionMessageMatchmaker.HandleMethodBeginClientEvent(message); _eventMatchMacker.AddBeginEvent(message); }
private void MarkItMatched(TestExecutionMethodBeginClientEvent message, Action <TestExecutionMethodBeginClientEvent> action) { _completedMessage.Add(message); action(message); }
private static string GetItemToSearchFor(TestExecutionMethodBeginClientEvent message) { return(message.ClassName + "." + message.MethodName); }
private void MarkItMatched(TestExecutionMethodBeginClientEvent message, Action<TestExecutionMethodBeginClientEvent> action) { _completedMessage.Add(message); action(message); }
private static string GetItemToSearchFor(TestExecutionMethodBeginClientEvent message) { return message.ClassName + "." + message.MethodName; }