Пример #1
0
        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();
        }
Пример #2
0
        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();
        }
Пример #3
0
        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();
        }
Пример #4
0
        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();
        }