예제 #1
0
        public void DoesNotQueueEvents()
        {
            var scopeProvider = new ScopeProvider(Mock.Of <IDatabaseFactory2>());
            var events        = scopeProvider.GetAmbientOrNoScope().Events;

            events.Dispatch(DoThing1, this, new EventArgs());
            events.Dispatch(DoThing2, this, new EventArgs());
            events.Dispatch(DoThing3, this, new EventArgs());

            Assert.IsEmpty(events.GetEvents(EventDefinitionFilter.All));
        }
예제 #2
0
        public void TriggersCancelableEvents()
        {
            var counter = 0;

            DoThing1 += (sender, args) => { counter++; };

            var scopeProvider = new ScopeProvider(Mock.Of <IDatabaseFactory2>());
            var events        = scopeProvider.GetAmbientOrNoScope().Events;

            events.DispatchCancelable(DoThing1, this, new CancellableEventArgs());

            Assert.AreEqual(1, counter);
        }