public void OnRegisterAndOnRemove() { // Get the Singleton View instance IModel model = Model.Instance; // Create and register the test mediator IProxy proxy = new ModelTestProxy(); model.RegisterProxy(proxy); // assert that onRegsiter was called, and the proxy responded by setting its data accordingly Assert.IsTrue(proxy.Data.ToString() == ModelTestProxy.ON_REGISTER_CALLED, "Expecting proxy.Data.ToString() == ModelTestProxy.ON_REGISTER_CALLED"); // Remove the component model.RemoveProxy(ModelTestProxy.NAME); // assert that onRemove was called, and the proxy responded by setting its data accordingly Assert.IsTrue(proxy.Data.ToString() == ModelTestProxy.ON_REMOVE_CALLED, "Expecting proxy.Data.ToString() == ModelTestProxy.ON_REMOVE_CALLED"); }
/** * Tests that the Model calls the onRegister and onRemove methods */ public void TestOnRegisterAndOnRemove() { // Get the Singleton View instance IModel model = Model.Instance; // Create and register the test mediator IProxy proxy = new ModelTestProxy(); model.RegisterProxy(proxy); // assert that onRegsiter was called, and the proxy responded by setting its data accordingly Assert.True(proxy.Data.ToString() == ModelTestProxy.ON_REGISTER_CALLED, "Expecting proxy.Data.ToString() == ModelTestProxy.ON_REGISTER_CALLED"); // Remove the component model.RemoveProxy(ModelTestProxy.NAME); // assert that onRemove was called, and the proxy responded by setting its data accordingly Assert.True(proxy.Data.ToString() == ModelTestProxy.ON_REMOVE_CALLED, "Expecting proxy.Data.ToString() == ModelTestProxy.ON_REMOVE_CALLED"); }