public void Should_Return_Exception_Whern_Input_ErrorBool(string argsText) { string schemaText = "l:bool p:int d:string"; ArgsParser argsArray = ArgsTests.InitArgsParam(argsText, schemaText, out ArgsSchema argsSchema); SchemaInfo info = argsSchema.GetSchemaInfo("l"); ObjectParse parse = new BoolParse(info, argsArray, "l"); Assert.Throws <ArgumentException>(() => parse.GetValue(), "-p:不是有效的bool类型!"); }
public void Should_Return_True_Whern_Input_Param(bool expectValue, string argsText) { string schemaText = "l:bool p:int d:string"; ArgsParser argsArray = ArgsTests.InitArgsParam(argsText, schemaText, out ArgsSchema argsSchema); SchemaInfo info = argsSchema.GetSchemaInfo("l"); ObjectParse parse = new BoolParse(info, argsArray, "l"); Assert.AreEqual(expectValue, parse.GetValue()); }