public void TestSuspendDoesntCallManipulationIfNotNeeded() { var controller = new DummyController(new ImageManipulatorTest.DummyManipulator(new CodedImage { Size = new Size(1, 1) })); Assert.IsFalse(controller.CallManipulationsCoreFired, "Precondition."); using (controller.SuspendCallManipulations()) { Assert.IsFalse(controller.CallManipulationsCoreFired, "CallManipulationsCore should not be fired while it is suspended."); } Assert.IsFalse(controller.CallManipulationsCoreFired, "CallManipulationsCore should not be fired if CallManipulations method was not not called during suspension."); }
public void TestSuspendCallManipulations() { var controller = new DummyController(new ImageManipulatorTest.DummyManipulator(new CodedImage { Size = new Size(1, 1) })); Assert.IsFalse(controller.CallManipulationsCoreFired, "Precondition."); controller.CallManipulations(); Assert.IsTrue(controller.CallManipulationsCoreFired, "CallManipulationsCore should be fired."); controller.CallManipulationsCoreFired = false; using (controller.SuspendCallManipulations()) { controller.CallManipulations(); Assert.IsFalse(controller.CallManipulationsCoreFired, "CallManipulationsCore should not be fired while it is suspended."); } Assert.IsTrue(controller.CallManipulationsCoreFired, "CallManipulationsCore should be automatically fired after suspension was released."); }