Пример #1
0
        public void ParsingMandatoryOptionWithArgumentsAndDefault_ThrowsExceptionIfMissing()
        {
            //******** GIVEN
            string[]  arguments = new string[] { "--singleOutput" };
            Exception thrownEx  = null;

            //******** WHEN
            MandatoryOptionWithArguments parsed = this._Parser.Parse <MandatoryOptionWithArguments>(arguments);

            //******** ASSERT
            thrownEx = this._Parser.GetLastError();
            Assert.IsNotNull(thrownEx);
            Assert.IsInstanceOfType(thrownEx, typeof(InvalidCLIArgumentException), $"Wrong type!!!" + thrownEx.Message);
            Assert.AreEqual("verbosity", ((InvalidCLIArgumentException)thrownEx).ArgumentCode, "Wrong invalid argument!!!");
        }
Пример #2
0
        public void ParsingMandatoryOptionWithArgumentsAndDefault_FillRelatedProperty()
        {
            //******** GIVEN
            string[]  arguments = new string[] { "--v" };
            Exception thrownEx  = null;

            //******** WHEN
            MandatoryOptionWithArguments parsed = this._Parser.Parse <MandatoryOptionWithArguments>(arguments);

            //******** ASSERT
            thrownEx = this._Parser.GetLastError();
            string message = "Expected no exception at this stage";

            if (thrownEx != null)
            {
                message += (": " + thrownEx.Message);
            }
            Assert.IsNull(thrownEx, message);
            Assert.IsNotNull(parsed);
            Assert.AreEqual(parsed.Verbosity, "DEFVAL");
        }