Ejemplo n.º 1
0
 public void ShouldNotCallCheckIfMonitorIsNotEnabled()
 {
     contentUpdatedEventFired = false;
     MockMonitor monitor = new MockMonitor("DisabledMonitor", true);
     monitor.Enabled = false;
     mModel.Add(monitor);
     Assert.IsFalse(monitor.IsCheckMethodCalled);
     mModel.Update();
     System.Threading.Thread.Sleep(1000);    // Multi-thread process time
     Assert.IsFalse(monitor.IsCheckMethodCalled);
     Assert.IsFalse(contentUpdatedEventFired);
 }
Ejemplo n.º 2
0
 public void ShouldFireEventWhenExceptionThrown()
 {
     contentUpdatedEventFired = false;
     MockMonitor monitor = new MockMonitor("ExceptionMonitor", true);
     monitor.ShouldThrownException = true;
     mModel.Add(monitor);
     Assert.IsTrue(monitor.ExceptionThrownEventAdded);
     Assert.IsFalse(monitor.ExceptionEventFired);
     mModel.Update();
     System.Threading.Thread.Sleep(1000);    // Multi-thread process time
     Assert.IsTrue(monitor.ExceptionEventFired);
     Assert.IsTrue(contentUpdatedEventFired);
 }
Ejemplo n.º 3
0
        public void ShouldContentUpdateEventFired()
        {
            contentUpdatedEventFired = false;

            MockMonitor monitor1 = new MockMonitor("DisabledMonitor", true);
            monitor1.Enabled = false;
            mModel.Add(monitor1);

            MockMonitor monitor2 = new MockMonitor("EnabledMonitor", true);
            monitor2.Enabled = true;
            mModel.Add(monitor2);

            mModel.Update();
            System.Threading.Thread.Sleep(1000);    // Multi-thread process time
            Assert.IsTrue(contentUpdatedEventFired);
        }