Ejemplo n.º 1
0
        public void CanCatchErrorsViaAttributes()
        {
            StartupArgs startupArgs = new StartupArgs();

            BoolMessageItem <Args> result = Args.Parse("-busdate:abc -dryrun:test", "-", ":", startupArgs);
            Args args = result.Item;

            Assert.IsFalse(result.Success);
            Assert.IsNotEmpty(result.Message);
        }
Ejemplo n.º 2
0
        public void CanParseUnNamedArgs()
        {
            StartupArgs startupArgs = new StartupArgs();

            BoolMessageItem <Args> result = Args.Parse("-config:Prod -dryrun:true ShowAll 8", "-", ":", startupArgs);
            Args args = result.Item;

            Assert.IsFalse(result.Success);
            Assert.IsNotEmpty(result.Message);
            Assert.AreEqual(startupArgs.Config, "Prod");
            Assert.AreEqual(startupArgs.DryRun, true);
            Assert.AreEqual(startupArgs.DefaultSettingsId, "ShowAll");
            Assert.AreEqual(startupArgs.CategoriesToDisplay, 8);
        }
Ejemplo n.º 3
0
        public void CanParseTextWithAttributes()
        {
            StartupArgs startupArgs = new StartupArgs();

            Args args = Args.Parse("-config:prod.xml -dateoffset:2 -busdate:${today} -dryrun:true", "-", ":", startupArgs).Item;

            Assert.AreEqual(args.Prefix, "-");
            Assert.AreEqual(args.Separator, ":");
            Assert.AreEqual(args.Named["config"], "prod.xml");
            Assert.AreEqual(args.Named["dateoffset"], "2");
            Assert.AreEqual(args.Named["dryrun"], "true");
            Assert.AreEqual(startupArgs.Config, "prod.xml");
            Assert.AreEqual(startupArgs.BusinessDateOffset, 2);
            Assert.AreEqual(startupArgs.BusinessDate, DateTime.Today);
            Assert.AreEqual(startupArgs.DryRun, true);
        }
Ejemplo n.º 4
0
        public void CanParseTextWithAttributesWithAlias()
        {
            StartupArgs startupArgs = new StartupArgs();

            string[] rawArgs = new string[] { "-c:prod.xml", "-d:2", "-b:${today}", "-dr:true" };
            Args     args    = Args.Parse(rawArgs, "-", ":", startupArgs).Item;

            Assert.AreEqual(args.Prefix, "-");
            Assert.AreEqual(args.Separator, ":");
            Assert.AreEqual(args.Named["c"], "prod.xml");
            Assert.AreEqual(args.Named["d"], "2");
            Assert.AreEqual(args.Named["dr"], "true");
            Assert.AreEqual(startupArgs.Config, "prod.xml");
            Assert.AreEqual(startupArgs.BusinessDateOffset, 2);
            Assert.AreEqual(startupArgs.BusinessDate, DateTime.Today);
            Assert.AreEqual(startupArgs.DryRun, true);
        }