Example #1
0
        public void ProcessChangeLiveResponse()
        {
            // Arrange
            const int    commandId         = 3;
            const int    moduleId          = 5;
            const string fileName          = "fileName.js";
            var          module            = new NodeModule(moduleId, fileName);
            var          changeLiveCommand = new ChangeLiveCommand(commandId, module);

            // Act
            changeLiveCommand.ProcessResponse(SerializationTestData.GetChangeLiveResponse());

            // Assert
            Assert.AreEqual(commandId, changeLiveCommand.Id);
            Assert.IsTrue(changeLiveCommand.Updated);
            Assert.IsTrue(changeLiveCommand.StackModified);
        }
Example #2
0
        public void CreateChangeLiveCommand()
        {
            // Arrange
            const int    commandId     = 3;
            const int    moduleId      = 5;
            const string fileName      = "fileName.js";
            const string source        = "source";
            string       wrappedSource = string.Format("{0}{1}{2}", NodeConstants.ScriptWrapBegin, source, NodeConstants.ScriptWrapEnd.Replace("\n", @"\n"));
            var          module        = new NodeModule(moduleId, fileName)
            {
                Source = source
            };

            // Act
            var changeLiveCommand = new ChangeLiveCommand(commandId, module);

            // Assert
            Assert.AreEqual(commandId, changeLiveCommand.Id);
            Assert.AreEqual(
                string.Format(
                    "{{\"command\":\"changelive\",\"seq\":{0},\"type\":\"request\",\"arguments\":{{\"script_id\":{1},\"new_source\":\"{2}\",\"preview_only\":false}}}}",
                    commandId, moduleId, wrappedSource),
                changeLiveCommand.ToString());
        }