コード例 #1
0
        public void IsRequired_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.IsRequired().Should().Be(setup);
        }
コード例 #2
0
        public void IsRequired_ShouldSetIsRequiredFlagOnOptionParser()
        {
            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.IsRequired();

            A.CallToSet(() => optionParser.IsOptionRequired).To(true).MustHaveHappened();
        }