public void GetCachedFormatterResult_RunFirstUpdateNoChange() { IScriptFormatter scriptFormatter = this.RegisterScriptFormatterInManager("scriptFormatter"); scriptFormatter.HasCachedVariable.Returns(false); scriptFormatter.UpdateCachedVariable().Returns(false); IScriptFormatter scriptFormatterHooked = this.RegisterScriptFormatterInManager("scriptFormatterHooked"); scriptFormatterHooked.Hooks.Returns(new HashSet <string>() { "%scriptFormatter%" }); this.scriptsManager.GetCachedResult("%" + scriptFormatter.Id + "%"); scriptFormatter.Received(1).UpdateCachedVariable(); scriptFormatterHooked.Received(0).UpdateCachedVariable(); }
public void CachedVariableChangedNotifySubscribersToUpdate_ScriptFormatter() { IScriptVariable scriptVariable = this.RegisterScriptVariableInManager("scriptVariable"); scriptVariable.Hooks.Returns(new HashSet <string>() { "%scriptFormatterHook%" }); IScriptFormatter scriptFormatter = this.RegisterScriptFormatterInManager("scriptFormatter"); scriptFormatter.Hooks.Returns(new HashSet <string>() { "%scriptFormatterHook%" }); IScriptFormatter scriptFormatterHook = this.RegisterScriptFormatterInManager("scriptFormatterHook"); scriptFormatterHook.CachedVariableChanged += Raise.Event <EventHandler <CachedVariableChangedEventArgs> >( scriptFormatterHook, new CachedVariableChangedEventArgs(1, 2)); scriptVariable.Received(0).UpdateCachedVariable(); // Variable does not have access to the cached variable of a formatter scriptFormatter.Received(1).UpdateCachedVariable(); }
public void NotifySubscribersToUpdate_ScriptFormatter() { IScriptVariable scriptVariable = this.RegisterScriptVariableInManager("scriptVariable"); scriptVariable.Hooks.Returns(new HashSet <string>() { "%scriptFormatterHook%" }); IScriptFormatter scriptFormatter = this.RegisterScriptFormatterInManager("scriptFormatter"); scriptFormatter.Hooks.Returns(new HashSet <string>() { "%scriptFormatterHook%" }); IScriptFormatter scriptFormatterHook = Substitute.For <IScriptFormatter>(); scriptFormatterHook.Id.Returns("scriptFormatterHook"); this.scriptsManager.NotifySubscribersToUpdate(scriptFormatterHook); scriptVariable.Received(0).UpdateCachedVariable(); // Variable does not have access to the cached variable of a formatter scriptFormatter.Received(1).UpdateCachedVariable(); }
public void NotifySubscribersToUpdate_ScriptVariable() { IScriptVariable scriptVariable = this.RegisterScriptVariableInManager("scriptVariable"); scriptVariable.Hooks.Returns(new HashSet <string>() { "scriptVariableHook" }); IScriptFormatter scriptFormatter = this.RegisterScriptFormatterInManager("scriptFormatter"); scriptFormatter.Hooks.Returns(new HashSet <string>() { "scriptVariableHook" }); IScriptVariable scriptVariableHook = Substitute.For <IScriptVariable>(); scriptVariableHook.Id.Returns("scriptVariableHook"); this.scriptsManager.NotifySubscribersToUpdate(scriptVariableHook); scriptVariable.Received(1).UpdateCachedVariable(); scriptFormatter.Received(1).UpdateCachedVariable(); }