Example #1
0
        public void DefaultValue_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.DefaultValue(new List <LogLevel>()).Should().Be(setup);
        }
Example #2
0
        public void DefaultValue_ShouldAssignDefaultValueToOptionParser()
        {
            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);

            var defaultValue = new List <LogLevel>();

            setup.DefaultValue(defaultValue);

            A.CallToSet(() => optionParser.OptionDefaultValue).To(defaultValue).MustHaveHappened();
        }