コード例 #1
0
        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);
        }
コード例 #2
0
        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 );
        }
コード例 #3
0
ファイル: XMLRepository.cs プロジェクト: saverydj/VTSImport
 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;
 }
コード例 #4
0
 public void Subscribe(ITestEvents events)
 {
     foreach (TextDisplayTabPage page in tabPages)
     {
         page.Display.Subscribe(events);
     }
 }
コード例 #5
0
 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);
 }
コード例 #6
0
ファイル: EventsTests.cs プロジェクト: mofashi2011/orchardcms
        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"));
        }
コード例 #7
0
        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"));
        }
コード例 #8
0
 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);
 }
コード例 #9
0
 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);
 }
コード例 #10
0
 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);
 }
コード例 #11
0
ファイル: NotRunTree.cs プロジェクト: taoxiease/asegrp
 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);
 }
コード例 #12
0
        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'"));
        }
コード例 #13
0
        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);
        }
コード例 #14
0
ファイル: EventsTests.cs プロジェクト: mofashi2011/orchardcms
        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'"));
        }
コード例 #15
0
        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);
        }
コード例 #16
0
        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);
        }
コード例 #17
0
        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);
        }
コード例 #18
0
        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);
        }
コード例 #19
0
        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);
        }
コード例 #20
0
        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);
        }
コード例 #21
0
        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);
        }
コード例 #22
0
        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);
        }
コード例 #23
0
        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);
        }
コード例 #24
0
        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);
        }
コード例 #25
0
        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);
        }
コード例 #26
0
		public void Subscribe(ITestEvents events)
		{
			events.TestOutput += new TestEventHandler(OnTestOutput);
			events.TestStarting += new TestEventHandler(OnTestStarting);
		}
コード例 #27
0
ファイル: ResultTabs.cs プロジェクト: Phaiax/dotnetautoupdate
			public void Subscribe(ITestEvents events)
			{
				foreach( TextDisplayTabPage page in tabPages )
					page.Display.Subscribe(events);
			}
コード例 #28
0
ファイル: ResultTabs.cs プロジェクト: Phaiax/dotnetautoupdate
		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);
		}
コード例 #29
0
 public void Subscribe(ITestEvents events)
 {
 }
コード例 #30
0
		public void Subscribe(ITestEvents events)
		{
			events.TestFinished += new TestEventHandler(OnTestFinished);
			events.SuiteFinished += new TestEventHandler(OnSuiteFinished);
			events.TestException += new TestEventHandler(OnTestException);
		}
コード例 #31
0
 public void Subscribe(ITestEvents events)
 {
     events.TestOutput   += new TestEventHandler(OnTestOutput);
     events.TestStarting += new TestEventHandler(OnTestStarting);
 }
コード例 #32
0
 public Task HandleEventAsync(ITestEvent e)
 {
     ITestEvents.Add(e);
     return(Task.CompletedTask);
 }
コード例 #33
0
ファイル: TestSuiteTreeView.cs プロジェクト: scottwis/eddie
        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 );
        }
コード例 #34
0
ファイル: ProgressBar.cs プロジェクト: fotisp/conqat
 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);
 }
コード例 #35
0
ファイル: SimpleTextDisplay.cs プロジェクト: kobida/nunitv2
		public void Subscribe(ITestEvents events)
		{
		}
コード例 #36
0
ファイル: ErrorDisplay.cs プロジェクト: xliuGeonx/solid
 public void Subscribe(ITestEvents events)
 {
     events.TestFinished  += new TestEventHandler(OnTestFinished);
     events.SuiteFinished += new TestEventHandler(OnSuiteFinished);
     events.TestException += new TestEventHandler(OnTestException);
 }
コード例 #37
0
		/// <summary>
		/// Creates a test event hook. Don't do this yourself -- use
		/// `MessagingSystem.Configure.WithLoopbackMode()`
		/// </summary>
		public TestEventHook(ITestEvents testEvents)
		{
			_testEvents = testEvents;
		}