コード例 #1
0
        public void FormatProvider_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.FormatProvider(new CultureInfo("de-DE")).Should().Be(setup);
        }
コード例 #2
0
        public void FormatProvider_ShouldAssignFormatProviderToOptionParser()
        {
            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 formatProvider = new CultureInfo("de-DE");

            setup.FormatProvider(formatProvider);

            A.CallToSet(() => optionParser.FormatProvider).To(formatProvider).MustHaveHappened();
        }