Example #1
0
        public void EnumValueHelp_ShouldReturnOptionSetup()
        {
            var commandParser = A.Fake <CommandParser <DataTypesCommandOptions> >();

            var targetProperty = typeof(DataTypesCommandOptions).GetProperty("Enums");
            var optionParser   = A.Fake <EnumListOptionParser <LogLevel> >(ob => ob.WithArgumentsForConstructor(() => new EnumListOptionParser <LogLevel>(targetProperty, "enums")));

            var setup = new EnumListOptionSetup <DataTypesCommandOptions, LogLevel>(commandParser, optionParser);

            setup.EnumValueHelp(LogLevel.Trace, "newEnumValueHelp").Should().Be(setup);
        }
Example #2
0
        public void EnumValueHelp_ShouldAssignEnumValueHelpToOptionParser()
        {
            var commandParser = A.Fake <CommandParser <DataTypesCommandOptions> >();

            var targetProperty = typeof(DataTypesCommandOptions).GetProperty("Enums");
            var optionParser   = A.Fake <EnumListOptionParser <LogLevel> >(ob => ob.WithArgumentsForConstructor(() => new EnumListOptionParser <LogLevel>(targetProperty, "enums")));
            var enumValueHelps = A.Fake <IDictionary <LogLevel, String> >();

            var setup = new EnumListOptionSetup <DataTypesCommandOptions, LogLevel>(commandParser, optionParser);

            A.CallTo(() => optionParser.EnumValuesHelps).Returns(enumValueHelps);

            setup.EnumValueHelp(LogLevel.Trace, "newEnumValueHelp");

            A.CallTo(() => enumValueHelps.Add(LogLevel.Trace, "newEnumValueHelp")).MustHaveHappened();
        }