예제 #1
0
        public void NotifySubscribersToUpdateFromMumbleLink()
        {
            MumbleLinkFile mumbleLinkFile = new MumbleLinkFile();

            this.scriptsManager.UseMumbleLinkFile(mumbleLinkFile);

            IScriptVariable scriptVariable = this.RegisterScriptVariableInManager("scriptVariable");

            scriptVariable.Hooks.Returns(new HashSet <string>()
            {
                "UIVersion"
            });

            mumbleLinkFile.UIVersion = 10;
            scriptVariable.Received(1).UpdateCachedVariable();
        }
예제 #2
0
        public void GetCachedVariableResult_RunFirstUpdateNoChange()
        {
            IScriptVariable scriptVariable = this.RegisterScriptVariableInManager("scriptVariable");

            scriptVariable.HasCachedVariable.Returns(false);
            scriptVariable.UpdateCachedVariable().Returns(false);
            IScriptVariable scriptVariableHooked = this.RegisterScriptVariableInManager("scriptVariableHooked");

            scriptVariableHooked.Hooks.Returns(new HashSet <string>()
            {
                "scriptVariable"
            });

            this.scriptsManager.GetCachedResult(scriptVariable.Id);
            scriptVariable.Received(1).UpdateCachedVariable();
            scriptVariableHooked.Received(0).UpdateCachedVariable();
        }
예제 #3
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();
        }
예제 #4
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();
        }
예제 #5
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();
        }