public void CanOptionParserUseOptionName_OptionNameIsAvailable_ShouldReturnTrue() { var parser = A.Fake <Parser>(); var commandParser = new CommandParser <Command1Options>(parser); var targetProperty = typeof(Command1Options).GetProperty("OptionA"); var optionParser = A.Fake <StringOptionParser>(ob => ob.WithArgumentsForConstructor(() => new StringOptionParser(targetProperty, "optionA"))); commandParser.CanOptionParserUseOptionName(optionParser, "optionA").Should().BeTrue(); }
public void CanOptionParserUseOptionName_OptionNameIsNotAvailable_ShouldReturnFalse() { var parser = A.Fake <Parser>(); var commandParser = new CommandParser <Command1Options>(parser); var targetPropertyA = typeof(Command1Options).GetProperty("OptionA"); var targetPropertyB = typeof(Command1Options).GetProperty("OptionB"); var optionParser1 = A.Fake <StringOptionParser>(ob => ob.WithArgumentsForConstructor(() => new StringOptionParser(targetPropertyA, "optionA"))); var optionParser2 = A.Fake <StringOptionParser>(ob => ob.WithArgumentsForConstructor(() => new StringOptionParser(targetPropertyB, "optionB"))); commandParser.OptionParsers.Add(optionParser1); commandParser.OptionParsers.Add(optionParser2); commandParser.CanOptionParserUseOptionName(optionParser2, "optionA").Should().BeFalse(); }