Beispiel #1
0
 private void PublishMessage()
 {
     TestingEvent fakeEvent = new TestingEvent {
         TestInt = 5, TestString = "TestString"
     };
     var bus    = InitProducer();
     var result = bus.PublishAsync(fakeEvent, "testingevent").GetAwaiter().GetResult();
 }
        private void LogScenario(TestingEvent testingEvent)
        {
            var scenarioName           = testingEvent.TestSketch.TestMethod.Name;
            var scenarioNameAsSentence = PascalCaseToSentenceConverter.Convert(scenarioName);
            var saidConvertedSentence  = SaidVariableToBracketedVariableConverter.Convert(scenarioNameAsSentence);

            Log(_indendation1 + "Scenario :" + saidConvertedSentence);
        }
        private static void LogEvent(TestingEvent testingEvent, TestSketch testSketch)
        {
            var eventLogger = BehaviourRecorderPluginFactory <IProcessedEventSink> .CreatePlugin();

            int eventCount = EventSerialNumberGenerator.GenerateSerialNumber(testSketch.UniqueTestCaseIdentifier);

            eventLogger.Sink(testingEvent, testSketch.UniqueTestCaseIdentifier, eventCount);
        }
Beispiel #4
0
        public ProcessedEvent ProcessEvent(TestingEvent testingEvent)
        {
            var processedEvent                = new MultipleLinesContainingProcessedEvent();
            var methodName                    = testingEvent.MethodName;
            var methodNameAsSentence          = PascalCaseToSentenceConverter.Convert(methodName);
            var saidVariableConvertedSentence = SaidVariableToBracketedVariableConverter.Convert(methodNameAsSentence);

            if (testingEvent.EventSubType == EventSubType.Started)
            {
                processedEvent.Lines.Add(saidVariableConvertedSentence);
            }
            return(processedEvent);
        }
        private TestingEvent CreateEvent(EventSubType subType, string methodName)
        {
            var testSketchProvider = BehaviourRecorderPluginFactory <ITestSketchProvider> .CreatePlugin();

            TestingEvent testingEvent = new TestingEvent();

            testingEvent.TestSketch            = testSketchProvider.GetTestSketch();
            testingEvent.EventCausingAttribute = this;
            testingEvent.EventType             = _eventType;
            testingEvent.EventSubType          = subType;
            testingEvent.MethodName            = methodName;
            //TODO testingEvent.ParameterTypeValuePairs;
            //TODO testingEvent.ParameterTypeValuePairsToBeLogged;
            return(testingEvent);
        }
Beispiel #6
0
        private async Task PublishMultipleMessages(int number)
        {
            var          bus       = InitProducer();
            TestingEvent fakeEvent = new TestingEvent {
                TestInt = 5, TestString = "TestString"
            };

            for (int i = 0; i < number; i++)
            {
                var result = await bus.PublishAsync(fakeEvent, "testingevent");

                if (!result)
                {
                    throw new Exception("Error publishing");
                }
            }
        }
 public void Sink(TestingEvent testingEvent, string uniqueTestCaseIdentifier, int eventCount)
 {
     if (IsFirstEvent(eventCount))
     {
         LogFeature(testingEvent);
         LogScenario(testingEvent);
     }
     if (testingEvent.EventSubType == EventSubType.Started)
     {
         if (testingEvent.EventType != EventType.Scenario)
         {
             var methodName            = testingEvent.MethodName;
             var methodNameAsSentence  = PascalCaseToSentenceConverter.Convert(methodName);
             var saidConvertedSentence = SaidVariableToBracketedVariableConverter.Convert(methodNameAsSentence);
             var eventString           = testingEvent.EventType.ToString();
             Log(_indendation2 + "(" + eventString + ") " + saidConvertedSentence);
         }
     }
 }
 public virtual void OnTestingEvent(TData obj)
 {
     TestingEvent?.Invoke(obj);
 }
        private void LogFeature(TestingEvent testingEvent)
        {
            var name = testingEvent.TestSketch.TestClassType.Name;

            Log("Feature :" + PascalCaseToSentenceConverter.Convert(name));
        }