public TestEventCatcher(ITestEvents source) { events = new TestEventArgsCollection(); source.ProjectLoading += new TestEventHandler(OnTestEvent); source.ProjectLoaded += new TestEventHandler(OnTestEvent); source.ProjectLoadFailed += new TestEventHandler(OnTestEvent); source.ProjectUnloading += new TestEventHandler(OnTestEvent); source.ProjectUnloaded += new TestEventHandler(OnTestEvent); source.ProjectUnloadFailed += new TestEventHandler(OnTestEvent); source.TestLoading += new TestEventHandler(OnTestEvent); source.TestLoaded += new TestEventHandler(OnTestEvent); source.TestLoadFailed += new TestEventHandler(OnTestEvent); source.TestUnloading += new TestEventHandler(OnTestEvent); source.TestUnloaded += new TestEventHandler(OnTestEvent); source.TestUnloadFailed += new TestEventHandler(OnTestEvent); source.TestReloading += new TestEventHandler(OnTestEvent); source.TestReloaded += new TestEventHandler(OnTestEvent); source.TestReloadFailed += new TestEventHandler(OnTestEvent); source.RunStarting += new TestEventHandler(OnTestEvent); source.RunFinished += new TestEventHandler(OnTestEvent); source.TestStarting += new TestEventHandler(OnTestEvent); source.TestFinished += new TestEventHandler(OnTestEvent); source.SuiteStarting += new TestEventHandler(OnTestEvent); source.SuiteFinished += new TestEventHandler(OnTestEvent); }
public TestEventCatcher( ITestEvents source ) { events = new TestEventArgsCollection(); source.ProjectLoading += new TestEventHandler( OnTestEvent ); source.ProjectLoaded += new TestEventHandler( OnTestEvent ); source.ProjectLoadFailed+= new TestEventHandler( OnTestEvent ); source.ProjectUnloading += new TestEventHandler( OnTestEvent ); source.ProjectUnloaded += new TestEventHandler( OnTestEvent ); source.ProjectUnloadFailed+= new TestEventHandler( OnTestEvent ); source.TestLoading += new TestEventHandler( OnTestEvent ); source.TestLoaded += new TestEventHandler( OnTestEvent ); source.TestLoadFailed += new TestEventHandler( OnTestEvent ); source.TestUnloading += new TestEventHandler( OnTestEvent ); source.TestUnloaded += new TestEventHandler( OnTestEvent ); source.TestUnloadFailed += new TestEventHandler( OnTestEvent ); source.TestReloading += new TestEventHandler( OnTestEvent ); source.TestReloaded += new TestEventHandler( OnTestEvent ); source.TestReloadFailed += new TestEventHandler( OnTestEvent ); source.RunStarting += new TestEventHandler( OnTestEvent ); source.RunFinished += new TestEventHandler( OnTestEvent ); source.TestStarting += new TestEventHandler( OnTestEvent ); source.TestFinished += new TestEventHandler( OnTestEvent ); source.SuiteStarting += new TestEventHandler( OnTestEvent ); source.SuiteFinished += new TestEventHandler( OnTestEvent ); }
public XMLRepository( IEntityQuery entityQuery, IVETSEntityManagerView entityManagerView, IEntityCreate entityCreate, ITestExecution testExecution, ITestStatus testStatus, ITestEvents testEvents, ISystemLogManager logger, IReportService resportService, IApplication application, IVETSEntityManagerViewModelView entityManagerViewModelView, VTS vts ) { _entityQuery = entityQuery; _entityManagerView = entityManagerView; _entityCreate = entityCreate; _testExecution = testExecution; _testStatus = testStatus; _testEvents = testEvents; _logger = logger; _resportService = resportService; _vts = vts; _application = application; _entityManagerViewModelView = entityManagerViewModelView; }
public void Subscribe(ITestEvents events) { foreach (TextDisplayTabPage page in tabPages) { page.Display.Subscribe(events); } }
public void Subscribe(ITestEvents events) { events.TestLoaded += new TestEventHandler(OnTestLoaded); events.TestUnloaded += new TestEventHandler(OnTestUnloaded); events.TestReloaded += new TestEventHandler(OnTestReloaded); events.RunStarting += new TestEventHandler(OnRunStarting); }
public void AllEventsAreCalled() { var events = new ITestEvents[] { new FooSink(), new BarSink() }; events.Invoke(x => x.Hello("world"), NullLogger.Instance); Assert.That(events.OfType<FooSink>().Single().Name, Is.EqualTo("world")); Assert.That(events.OfType<BarSink>().Single().Name, Is.EqualTo("world")); }
public void Initialize(ITestEvents events) { events.TestLoaded += new TestEventHandler(OnLoadComplete); events.TestReloaded += new TestEventHandler(OnLoadComplete); events.TestUnloaded += new TestEventHandler(OnUnloadComplete); events.RunStarting += new TestEventHandler(OnRunStarting); events.TestFinished += new TestEventHandler(OnTestFinished); }
public void Subscribe(ITestEvents events) { events.TestLoaded += new TestEventHandler(OnLoadComplete); events.TestReloaded += new TestEventHandler(OnLoadComplete); events.TestUnloaded += new TestEventHandler(OnUnloadComplete); events.RunStarting += new TestEventHandler(OnRunStarting); events.TestFinished += new TestEventHandler(OnTestFinished); events.TestException += new TestEventHandler(OnTestException); }
public void Subscribe(ITestEvents events) { events.TestLoaded += new TestEventHandler(ClearTreeNodes); events.TestUnloaded += new TestEventHandler(ClearTreeNodes); events.TestReloaded += new TestEventHandler(OnTestReloaded); events.RunStarting += new TestEventHandler(ClearTreeNodes); events.TestFinished += new TestEventHandler(OnTestFinished); events.SuiteFinished += new TestEventHandler(OnTestFinished); }
public void AnExceptionShouldBeLoggedAndOtherEventsWillBeFired() { var events = new ITestEvents[] { new FooSink(), new CrashSink(), new BarSink() }; var logger = new TestLogger(); events.Invoke(x => x.Hello("world"), logger); Assert.That(events.OfType<FooSink>().Single().Name, Is.EqualTo("world")); Assert.That(events.OfType<BarSink>().Single().Name, Is.EqualTo("world")); Assert.That(logger.LogException, Is.TypeOf<ApplicationException>()); Assert.That(logger.LogException, Has.Property("Message").EqualTo("Illegal name 'world'")); }
public void EventWithReturnValue3() { BeethovenFactory factory = new BeethovenFactory(); ITestEvents test = factory.Generate <ITestEvents>(); IEventTrigger trigger = factory.CreateEventTrigger(test, nameof(ITestEvents.WithReturnValue)); test.WithReturnValue += value => false; test.WithReturnValue += value => true; bool returnValue = (bool)trigger.Notify("123"); Assert.AreEqual(true, returnValue); }
public void EventWithReturnValue3() { BeethovenFactory factory = new BeethovenFactory(); ITestEvents test = factory.Generate <ITestEvents>(); Func <string, bool> trigger = new EventTrigger(test, nameof(ITestEvents.WithReturnValue)).ToFunc <string, bool>(); test.WithReturnValue += value => false; test.WithReturnValue += value => true; bool returnValue = trigger("123"); Assert.AreEqual(true, returnValue); }
public void EventSimpleRemoved1() { BeethovenFactory factory = new BeethovenFactory(); ITestEvents test = factory.Generate <ITestEvents>(); Action trigger = new EventTrigger(test, nameof(ITestEvents.Simple)).ToAction(); bool simpleEventCalled = false; Action delegate1 = delegate { simpleEventCalled = true; }; test.Simple += delegate1; test.Simple -= delegate1; trigger(); Assert.IsFalse(simpleEventCalled); }
public void Initialize(ITestLoader loader, ITestEvents events) { this.loader = loader; events.TestLoaded += new TestEventHandler(OnTestLoaded); events.TestReloaded += new TestEventHandler(OnTestChanged); events.TestUnloaded += new TestEventHandler(OnTestUnloaded); events.RunStarting += new TestEventHandler(OnRunStarting); events.RunFinished += new TestEventHandler(OnRunFinished); events.TestFinished += new TestEventHandler(OnTestResult); events.SuiteFinished += new TestEventHandler(OnTestResult); }
public void EventWithParameters2() { BeethovenFactory factory = new BeethovenFactory(); ITestEvents test = factory.Generate <ITestEvents>(); IEventTrigger trigger = factory.CreateEventTrigger(test, nameof(ITestEvents.WithParameters)); double gotValue1 = 0; string gotValue2 = null; test.WithParameters += (value1, value2) => gotValue1 = value1; test.WithParameters += (value1, value2) => gotValue2 = value2; trigger.Notify(54.0, "abe"); Assert.AreEqual(54.0, gotValue1); Assert.AreEqual("abe", gotValue2); }
public void EventSimple2() { TypeDefinition <ITestEvents> typeDefinition = new TypeDefinition <ITestEvents>(); ITestEvents test = typeDefinition.Create(); IEventTrigger trigger = typeDefinition.CreateEventTrigger(test, nameof(ITestEvents.Simple)); bool simpleEventCalled = false; bool otherEventCalled = false; test.Simple += delegate { simpleEventCalled = true; }; test.WithParameters += delegate { otherEventCalled = true; }; test.WithReturnValue += delegate { return(otherEventCalled = true); }; trigger.Notify(); Assert.IsTrue(simpleEventCalled); Assert.IsFalse(otherEventCalled); }
public void EventWithReturnValue1() { BeethovenFactory factory = new BeethovenFactory(); ITestEvents test = factory.Generate <ITestEvents>(); IEventTrigger trigger = factory.CreateEventTrigger(test, nameof(ITestEvents.WithReturnValue)); bool withReturnValueEventCalled = false; bool otherEventCalled = false; test.Simple += delegate { otherEventCalled = true; }; test.WithParameters += delegate { otherEventCalled = true; }; test.WithReturnValue += delegate { return(withReturnValueEventCalled = true); }; trigger.Notify(""); Assert.IsTrue(withReturnValueEventCalled); Assert.IsFalse(otherEventCalled); }
public void EventWithParameters1() { BeethovenFactory factory = new BeethovenFactory(); ITestEvents test = factory.Generate <ITestEvents>(); Action <double, string> trigger = new EventTrigger(test, nameof(ITestEvents.WithParameters)).ToAction <double, string>(); bool withParametersEventCalled = false; bool otherEventCalled = false; test.Simple += delegate { otherEventCalled = true; }; test.WithParameters += delegate { withParametersEventCalled = true; }; test.WithReturnValue += delegate { return(otherEventCalled = true); }; trigger(4.4, ""); Assert.IsTrue(withParametersEventCalled); Assert.IsFalse(otherEventCalled); }
public void EventSimpleError() { BeethovenFactory factory = new BeethovenFactory(); ITestEvents test = factory.Generate <ITestEvents>(new DefaultEvent()); Action <int> trigger = new EventTrigger(test, nameof(ITestEvents.Simple)).ToAction <int>(); bool simpleEventCalled = false; bool otherEventCalled = false; test.Simple += delegate { simpleEventCalled = true; }; test.WithParameters += delegate { otherEventCalled = true; }; test.WithReturnValue += delegate { return(otherEventCalled = true); }; trigger(123); Assert.IsTrue(simpleEventCalled); Assert.IsFalse(otherEventCalled); }
public void EventWithReturnValue2() { BeethovenFactory factory = new BeethovenFactory(); ITestEvents test = factory.Generate <ITestEvents>(); IEventTrigger trigger = factory.CreateEventTrigger(test, nameof(ITestEvents.WithReturnValue)); string gotValue = null; test.WithReturnValue += value => { gotValue = value; return(true); }; bool returnValue = (bool)trigger.Notify("123"); Assert.AreEqual(true, returnValue); Assert.AreEqual("123", gotValue); }
public void ConstructorInitializedFieldEventWithReturnValue1() { CompiledTypeDefinition <ITestEvents> compiledTypeDefinition = TypeDefinition <ITestEvents> .Create().Compile(); ITestEvents test = compiledTypeDefinition.Create(); Action <string> trigger = new EventTrigger(test, nameof(ITestEvents.WithReturnValue)).ToAction <string>(); bool withReturnValueEventCalled = false; bool otherEventCalled = false; test.Simple += delegate { otherEventCalled = true; }; test.WithParameters += delegate { otherEventCalled = true; }; test.WithReturnValue += delegate { return(withReturnValueEventCalled = true); }; trigger(""); Assert.IsTrue(withReturnValueEventCalled); Assert.IsFalse(otherEventCalled); }
protected override void OnLoad(EventArgs e) { if (!this.DesignMode) { this.settings = Services.UserSettings; TextDisplayTabSettings tabSettings = new TextDisplayTabSettings(); tabSettings.LoadSettings(settings); UpdateTabPages(); Subscribe(Services.TestLoader.Events); Services.UserSettings.Changed += new SettingsEventHandler(UserSettings_Changed); ITestEvents events = Services.TestLoader.Events; errorDisplay.Subscribe(events); notRunTree.Subscribe(events); } base.OnLoad(e); }
public void Subscribe(ITestEvents events) { events.TestOutput += new TestEventHandler(OnTestOutput); events.TestStarting += new TestEventHandler(OnTestStarting); }
public void Subscribe(ITestEvents events) { foreach( TextDisplayTabPage page in tabPages ) page.Display.Subscribe(events); }
public void Subscribe(ITestEvents events) { }
public void Subscribe(ITestEvents events) { events.TestFinished += new TestEventHandler(OnTestFinished); events.SuiteFinished += new TestEventHandler(OnSuiteFinished); events.TestException += new TestEventHandler(OnTestException); }
public Task HandleEventAsync(ITestEvent e) { ITestEvents.Add(e); return(Task.CompletedTask); }
public void Initialize( ITestLoader loader, ITestEvents events ) { this.loader = loader; events.TestLoaded += new TestEventHandler( OnTestLoaded ); events.TestReloaded += new TestEventHandler( OnTestChanged ); events.TestUnloaded += new TestEventHandler( OnTestUnloaded ); events.RunStarting += new TestEventHandler( OnRunStarting ); events.RunFinished += new TestEventHandler( OnRunFinished ); events.TestFinished += new TestEventHandler( OnTestResult ); events.SuiteFinished+= new TestEventHandler( OnTestResult ); }
public void Subscribe(ITestEvents events) { events.TestLoaded += new TestEventHandler( OnLoadComplete ); events.TestReloaded += new TestEventHandler( OnLoadComplete ); events.TestUnloaded += new TestEventHandler( OnUnloadComplete ); events.RunStarting += new TestEventHandler( OnRunStarting ); events.TestFinished += new TestEventHandler( OnTestFinished ); events.TestException += new TestEventHandler(OnTestException); }
/// <summary> /// Creates a test event hook. Don't do this yourself -- use /// `MessagingSystem.Configure.WithLoopbackMode()` /// </summary> public TestEventHook(ITestEvents testEvents) { _testEvents = testEvents; }