예제 #1
0
        public void defaults_arguments()
        {
            const string expectedOptionalArgument
                = ParametersObject.OPTIONAL_PARAMETER_DEFAULT;

            const int expectedRequiredArgument =
                ParametersObject.REQUIRED_PARAMETER_MINIMUM;

            var result = ParametersObject.Create(expectedRequiredArgument);

            Assert.Equal(expectedOptionalArgument, result.OptionalParameter);
            Assert.Equal(expectedRequiredArgument, result.RequiredParameter);
        }
예제 #2
0
        public void assigns_arguments()
        {
            const string expectedOptionalArgument = EXPECTED_OPTIONAL_ARGUMENT;
            const int    expectedRequiredArgument =
                ParametersObject.REQUIRED_PARAMETER_MINIMUM;

            var result = ParametersObject.Create(
                expectedRequiredArgument,
                i => { i.OptionalParameter = expectedOptionalArgument; });

            Assert.Equal(expectedOptionalArgument, result.OptionalParameter);
            Assert.Equal(expectedRequiredArgument, result.RequiredParameter);
        }
예제 #3
0
        public void validates_arguments()
        {
            const string expectedOptionalArgument = EXPECTED_OPTIONAL_ARGUMENT;
            const int    expectedRequiredArgument =
                ParametersObject.REQUIRED_PARAMETER_MINIMUM - 1;

            var ex = Assert.Throws <ArgumentOutOfRangeException>(
                () => ParametersObject.Create(
                    expectedRequiredArgument,
                    i => { i.OptionalParameter = expectedOptionalArgument; })
                );

            Assert.Equal("RequiredParameter", ex.ParamName);
        }