static Script ParseScript(string BaseDir, string ScriptName) { List <IScriptCommand> Commands = new List <IScriptCommand>(); string UnparsedCommand; System.IO.StreamReader file = new System.IO.StreamReader(String.Format(@"{0}\{1}", BaseDir, ScriptName)); while ((UnparsedCommand = file.ReadLine()) != null) { if (UnparsedCommand.StartsWith("//")) { continue; } RawCommand Raw = ParseScriptLine(UnparsedCommand); IScriptCommand Command = CommandFactory.BuildCommand(Raw); Commands.Add(Command); } return(BuildScriptTree(Commands)); }
public void ThrowsExceptionIfInvalid() { var moduleMock = new Mock <IModuleBuilder>(); moduleMock.SetupGet(a => a.Type).Returns(typeof(TestCommandClass)); var moduleBuilder = moduleMock.Object; var method = typeof(TestCommandClass) .GetMethod(nameof(TestCommandClass.InvalidCommand)); Assert.Throws <ArgumentException>(() => { _ = _factory.BuildCommand(moduleBuilder, method); }); }