public void CallsShutdownOrSavingDependingOnContext( [Values(Component.ShutdownContext.Saving, Component.ShutdownContext.Deactivate)]Component.ShutdownContext context, [Values(false, true)]bool expectedShutdownResult, [Values(true, false)]bool expectedSavingResult) { var component = new ScriptComponent { Script = TestScriptFactory.CreateScriptResource(TestScriptWithShutdown) }; component.OnInit(Component.InitContext.Activate); component.SetScriptPropertyValue("ShutdownCalled", false); component.SetScriptPropertyValue("SavingCalled", false); component.OnShutdown(context); ((ICmpEditorUpdatable)component).OnUpdate(); Assert.AreEqual(expectedShutdownResult, (bool)component.ScriptPropertyValues["ShutdownCalled"]); Assert.AreEqual(expectedSavingResult, (bool)component.ScriptPropertyValues["SavingCalled"]); }
public void ReturnsExistingProperties() { var value = new object(); var component = new ScriptComponent(); component.SetScriptPropertyValue("test", value); Assert.AreSame(value, component.GetScriptPropertyValue("test")); }