public void CommandEquality() { string rawLine = "::from ./bsinstalldir.txt"; CommandNode.CommandType commandType = CommandNode.CommandType.From; string commandData = "./bsinstalldir.txt"; CommandNode node1 = new CommandNode(rawLine); CommandNode node2 = new CommandNode(commandType, commandData); Assert.AreEqual(node1.RawLine, node2.RawLine); rawLine = "::startopt"; commandType = CommandNode.CommandType.OptionalBlock; commandData = ""; node1 = new CommandNode(rawLine); node2 = new CommandNode(commandType, commandData); Assert.AreEqual(node1.RawLine, node2.RawLine); //rawLine = "::endopt"; //commandType = CommandNode.CommandType.EndOptionalBlock; //commandData = ""; node1 = new CommandNode(rawLine); node2 = new CommandNode(commandType, commandData); Assert.AreEqual(node1.RawLine, node2.RawLine); }
public override bool InsertReference(FileEntry fileEntry, bool optional = false) { if (base.InsertReference(fileEntry, optional)) { return(true); } CommandNode newCommand; RefsNode currentNode = this; CommandNode.CommandType commandType = fileEntry.PathSource == CommandNode.PromptSourceTag ? CommandNode.CommandType.Prompt : CommandNode.CommandType.From; Add(new CommandNode(CommandNode.CommandType.EmptyLine, null)); if (optional) { newCommand = new CommandNode(CommandNode.CommandType.OptionalBlock, null); Add(newCommand); currentNode = newCommand; } newCommand = new CommandNode(commandType, fileEntry.PathSource); currentNode.Add(newCommand); return(newCommand.InsertReference(fileEntry, optional)); }