public void CreateSetBreakpointCommand() { // Arrange const int commandId = 3; const int moduleId = 5; const int line = 2; const int column = 0; const string fileName = "module.js"; var module = new NodeModule(moduleId, fileName); var breakOn = new BreakOn(BreakOnKind.Equal, 2); var position = new FilePosition(fileName, line, column); var breakpoint = new NodeBreakpoint(null, position, true, breakOn, null); // Act var setBreakpointCommand = new SetBreakpointCommand(commandId, module, breakpoint, false, false); // Assert Assert.AreEqual(commandId, setBreakpointCommand.Id); Assert.AreEqual( string.Format( "{{\"command\":\"setbreakpoint\",\"seq\":{0},\"type\":\"request\",\"arguments\":{{\"line\":{1},\"column\":{2},\"type\":\"scriptId\",\"target\":{3},\"ignoreCount\":1}}}}", commandId, line, column, module.Id), setBreakpointCommand.ToString()); }
public void CreateSetBreakpointCommandOnLocalFile() { // Arrange const int commandId = 3; const int line = 2; const int column = 0; const string fileName = @"c:\module.js"; var breakOn = new BreakOn(BreakOnKind.Equal, 2); var position = new FilePosition(fileName, line, column); var breakpoint = new NodeBreakpoint(null, position, true, breakOn, null); // Act var setBreakpointCommand = new SetBreakpointCommand(commandId, null, breakpoint, false, false); // Assert Assert.AreEqual(commandId, setBreakpointCommand.Id); Assert.AreEqual( string.Format( "{{\"command\":\"setbreakpoint\",\"seq\":{0},\"type\":\"request\",\"arguments\":{{\"line\":{1},\"column\":{2},\"type\":\"scriptRegExp\",\"target\":\"{3}\",\"ignoreCount\":1}}}}", commandId, line, column, SetBreakpointCommand.CreateLocalScriptRegExp(fileName).Replace(@"\", @"\\")), setBreakpointCommand.ToString()); }
public void CreateSetBreakpointCommandOnRemoteFile() { // Arrange const int commandId = 3; const int line = 2; const int column = 0; const string fileName = @"module.js"; var breakOn = new BreakOn(BreakOnKind.Equal, 2); var position = new FilePosition(fileName, line, column); var breakpoint = new NodeBreakpoint(null, position, true, breakOn, null); // Act var setBreakpointCommand = new SetBreakpointCommand(commandId, null, breakpoint, false, true); // Assert Assert.AreEqual(commandId, setBreakpointCommand.Id); Assert.AreEqual( string.Format( "{{\"command\":\"setbreakpoint\",\"seq\":{0},\"type\":\"request\",\"arguments\":{{\"line\":{1},\"column\":{2},\"type\":\"scriptRegExp\",\"target\":\"^[Mm][Oo][Dd][Uu][Ll][Ee]\\\\.[Jj][Ss]$\",\"ignoreCount\":1}}}}", commandId, line, column), setBreakpointCommand.ToString()); }