Example #1
0
        public void WhenBoolArgNotValidDigit_ShouldSetDefault()
        {
            var testConfig = new TestConsoleConfiguration(new[] { "bool=2" });

            Assert.IsTrue(testConfig.NotValidParameters);
            Assert.AreEqual(default(bool), testConfig.BoolArg);
        }
Example #2
0
        public void WhenBoolArgAsZeroDigit_ShouldSetFalse()
        {
            var testConfig = new TestConsoleConfiguration(new[] { "bool=0" });

            Assert.IsFalse(testConfig.NotValidParameters);
            Assert.AreEqual(false, testConfig.BoolArg);
        }
Example #3
0
        public void WhenBoolArgAsOneDigit_ShouldSetTrue()
        {
            var testConfig = new TestConsoleConfiguration(new[] { "bool=1" });

            Assert.AreEqual(testConfig.NotValidParameters, false);
            Assert.AreEqual(testConfig.BoolArg, true);
        }
Example #4
0
        public void WhenArgumentsIsNotDescribed_ShouldReturnDefault()
        {
            var testConfig = new TestConsoleConfiguration();

            Assert.AreEqual(null, testConfig.StringArg);
            Assert.AreEqual(TestDefaultCharArg, testConfig.CharArg);
            Assert.AreEqual(TestDefaultBoolArg, testConfig.BoolArg);
            Assert.AreEqual(TestDefaultBoolArg, testConfig.BoolDigitArg);
            Assert.AreEqual(TestDefaultDoubleArg, testConfig.DecimalArg);
            Assert.AreEqual(TestDefaultDoubleArg, testConfig.DoubleArg);
            Assert.AreEqual(TestDefaultDoubleArg, testConfig.FloatArg);
            Assert.AreEqual(TestDefaultDoubleArg, testConfig.ErrorArg);
            Assert.AreEqual(default(int), testConfig.WithoutDefaultArg);

            Assert.IsFalse(testConfig.NotValidParameters);
        }
Example #5
0
        public void WhenArgumentsIsValid_ShouldSetExpectedValues()
        {
            var testConfig = new TestConsoleConfiguration(TestArguments);

            Assert.AreEqual(testConfig.StringArg, TestStringArg);
            Assert.AreEqual(testConfig.CharArg, TestCharArg);
            Assert.AreEqual(testConfig.BoolArg, TestBoolArg);
            Assert.AreEqual(testConfig.BoolDigitArg, TestBoolArg);
            Assert.AreEqual(testConfig.DecimalArg, TestDecimalArg);
            Assert.AreEqual(testConfig.DoubleArg, TestDefaultDoubleArg);
            Assert.AreEqual(testConfig.FloatArg, TestDefaultDoubleArg);
            Assert.AreNotEqual(testConfig.ErrorArg, TestDefaultDoubleArg);
            Assert.AreEqual(testConfig.WithoutDefaultArg, 0);

            Assert.AreEqual(testConfig.NotValidParameters, true);
            Assert.AreEqual(testConfig.NotValidParametersMessages.Count, 1);
        }
Example #6
0
        public void WhenArgumentsIsEmpty_ShouldReturnNoParametersSpecified()
        {
            var testConfig = new TestConsoleConfiguration(new string[] { });

            Assert.IsTrue(testConfig.NoParameters);
        }