Пример #1
0
        public void Run_should_throw_ArgumentNullException_if_given_null_args()
        {
            //  arrange
            var cmd = new MockCommand1();

            //  act
            //  assert
            Assert.Throws <ArgumentNullException>(() => cmd.Run(null));
        }
        public void Run_should_throw_ArgumentNullException_if_given_null_args()
        {
            //  arrange
            var cmd = new MockCommand1();

            //  act
            //  assert
            Assert.Throws<ArgumentNullException>(() => cmd.Run(null));
        }
Пример #3
0
        public void Run_should_throw_InvalidOperationException_if_Log_property_is_null()
        {
            //  arrange
            var cmd  = new MockCommand1();
            var args = new MockCommandArgs();

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

            Assert.AreEqual("ICommand.Log cannot be null.", ex.Message);
        }
        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);
        }
Пример #5
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 Run_should_throw_InvalidOperationException_if_args_are_not_valid()
        {
            //  arrange
            var cmd = new MockCommand1();
            cmd.Log = new MockLog1();
            ArgumentSet argSet = ArgumentSet.Parse(new[] { "blah" });
            var args = new MockCommandArgs();
            args.Parse(argSet);

            //  act
            var ex = Assert.Throws<InvalidOperationException>(() => cmd.Run(args));
            Assert.AreEqual("Argument validation failed. Arguments are invalid.", ex.Message);
        }
Пример #7
0
        public void Run_should_throw_InvalidOperationException_if_args_are_not_valid()
        {
            //  arrange
            var cmd = new MockCommand1();

            cmd.Log = new MockLog1();
            ArgumentSet argSet = ArgumentSet.Parse(new[] { "blah" });
            var         args   = new MockCommandArgs();

            args.Parse(argSet);

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

            Assert.AreEqual("Argument validation failed. Arguments are invalid.", ex.Message);
        }
        public void Run_should_throw_InvalidOperationException_if_Log_property_is_null()
        {
            //  arrange
            var cmd = new MockCommand1();
            var args = new MockCommandArgs();

            //  act
            var ex = Assert.Throws<InvalidOperationException>(() => cmd.Run(args));
            Assert.AreEqual("ICommand.Log cannot be null.", ex.Message);
        }