コード例 #1
0
        public void DefaultValue_ShouldReturnOptionSetup()
        {
            var commandParser = A.Fake <CommandParser <DataTypesCommandOptions> >();

            var targetProperty = typeof(DataTypesCommandOptions).GetProperty("Decimals");
            var optionParser   = A.Fake <DecimalListOptionParser>(ob => ob.WithArgumentsForConstructor(() => new DecimalListOptionParser(targetProperty, "decimals")));

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

            setup.DefaultValue(new List <Decimal>()).Should().Be(setup);
        }
コード例 #2
0
        public void DefaultValue_ShouldAssignDefaultValueToOptionParser()
        {
            var commandParser = A.Fake <CommandParser <DataTypesCommandOptions> >();

            var targetProperty = typeof(DataTypesCommandOptions).GetProperty("Decimals");
            var optionParser   = A.Fake <DecimalListOptionParser>(ob => ob.WithArgumentsForConstructor(() => new DecimalListOptionParser(targetProperty, "decimals")));

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

            var defaultValue = new List <Decimal>();

            setup.DefaultValue(defaultValue);

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