public void CreateScriptsCommand() { // Arrange const int commandId = 3; const bool includeSource = true; // Act var scriptsCommand = new ScriptsCommand(commandId, includeSource); // Assert Assert.AreEqual(commandId, scriptsCommand.Id); Assert.AreEqual( string.Format( "{{\"command\":\"scripts\",\"seq\":{0},\"type\":\"request\",\"arguments\":{{\"includeSource\":{1}}}}}", commandId, includeSource.ToString().ToLower()), scriptsCommand.ToString()); }
public void CreateScriptsCommandWithOptionalParameters() { // Arrange const int commandId = 3; const int moduleId = 5; const bool includeSource = false; // Act var scriptsCommand = new ScriptsCommand(commandId, includeSource, moduleId); // Assert Assert.AreEqual(commandId, scriptsCommand.Id); Assert.AreEqual( string.Format( "{{\"command\":\"scripts\",\"seq\":{0},\"type\":\"request\",\"arguments\":{{\"includeSource\":{1},\"ids\":[{2}]}}}}", commandId, includeSource.ToString().ToLower(CultureInfo.InvariantCulture), moduleId), scriptsCommand.ToString()); }
public void ProcessScriptsResponse() { // Arrange const int commandId = 3; const bool includeSource = true; const string nodejs = "node.js"; var scriptsCommand = new ScriptsCommand(commandId, includeSource); // Act scriptsCommand.ProcessResponse(SerializationTestData.GetScriptsResponse()); // Assert Assert.AreEqual(commandId, scriptsCommand.Id); Assert.IsNotNull(scriptsCommand.Modules); Assert.AreEqual(17, scriptsCommand.Modules.Count); NodeModule module = scriptsCommand.Modules[0]; Assert.AreEqual(nodejs, module.Name); Assert.AreEqual(nodejs, module.Source); Assert.AreEqual(nodejs, module.FileName); Assert.AreEqual(nodejs, module.JavaScriptFileName); Assert.AreEqual(17, module.Id); }