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

            var targetProperty = typeof(DataTypesCommandOptions).GetProperty("String");
            var optionParser   = A.Fake <StringOptionParser>(ob => ob.WithArgumentsForConstructor(() => new StringOptionParser(targetProperty, "string")));

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

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

            var targetProperty = typeof(DataTypesCommandOptions).GetProperty("String");
            var optionParser   = A.Fake <StringOptionParser>(ob => ob.WithArgumentsForConstructor(() => new StringOptionParser(targetProperty, "string")));

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

            var defaultValue = "newDefaultValue";

            setup.DefaultValue(defaultValue);

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