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

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