예제 #1
0
        public void IsRequired_ShouldReturnOptionSetup()
        {
            var commandParser = A.Fake <CommandParser <DataTypesCommandOptions> >();

            var targetProperty = typeof(DataTypesCommandOptions).GetProperty("Decimal");
            var optionParser   = A.Fake <DecimalOptionParser>(ob => ob.WithArgumentsForConstructor(() => new DecimalOptionParser(targetProperty, "decimal")));

            var setup = new DecimalOptionSetup <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("Decimal");
            var optionParser   = A.Fake <DecimalOptionParser>(ob => ob.WithArgumentsForConstructor(() => new DecimalOptionParser(targetProperty, "decimal")));

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

            setup.IsRequired();

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