public void Validation_should_succeed_if_Connection_has_value()
        {
            //  arrange
            var argSet = ArgumentSet.Parse(new string[] { "-c", "my_connection" });
            var args   = new DatabaseCommandArguments();

            //  act
            args.Parse(argSet);

            //  assert
            Assert.IsTrue(args.IsValid);
        }
Ejemplo n.º 2
0
        public void Run_should_throw_ArgumentException_if_args_type_doesnt_match_generic_TArgs()
        {
            //  arrange
            var cmd  = new MockCommand1();
            var args = new DatabaseCommandArguments();

            //  act
            //  assert
            var ex = Assert.Throws <ArgumentException>(() => cmd.Run(args));

            Assert.AreEqual("args type doesn't match generic type\r\nParameter name: args", ex.Message);
        }
        public void Validation_should_fail_if_Connection_is_null_or_empty()
        {
            //  arrange
            var argSet = ArgumentSet.Parse(new string[] { string.Empty });
            var args   = new DatabaseCommandArguments();

            //  act
            args.Parse(argSet);

            //  assert
            Assert.IsFalse(args.IsValid);
            Assert.AreEqual(1, args.Errors.Count());
        }
 public void FixtureSetup()
 {
     _commandArgs            = new DatabaseCommandArguments();
     _commandArgs.Connection = TestConnectionString;
 }