Ejemplo n.º 1
0
        public void ModuleHost_ShouldSortCancelableDelegatesByPriority()
        {
            // Given
            var events = new DummyEvents();
            var m0     = new DummyMod1();

            m0.Initialize(events);

            var m1 = new DummyMod1();

            m1.Initialize(events);

            var m2 = new DummyMod2(0);

            m2.Initialize(events);

            var loader = new Mock <ILoader <IDummyEvents> >();
            var host   = new TestModuleHost(loader.Object, events);

            // When/Then - Exception thrown if execution is out of sequence
            var args = new DummyCancelEventArgs {
                ExecutionCount = 0
            };

            host.InvokeCanCancelEvent(args);
        }
Ejemplo n.º 2
0
 private void DummyCancelHandler(DummyCancelEventArgs e)
 {
     if (ExpectedExecutionCount >= 0 && e.ExecutionCount != ExpectedExecutionCount)
     {
         throw new Exception($"Expecting execution order of {ExpectedExecutionCount} nut was {e.ExecutionCount}");
     }
     e.ExecutionCount++;
 }
Ejemplo n.º 3
0
 public DummyCancelEventArgs InvokeCanCancelEvent(DummyCancelEventArgs args = null)
 {
     try
     {
         return(InvokeCancelableModuleEvent(Events.CanCancel, args ?? new DummyCancelEventArgs()));
     }
     catch (Exception)
     {
         throw;
     }
 }