Пример #1
0
        [Test] public void ExecutesProcedureWithInputParameter() {
            var command = new TestCommand {
                NonQueryAction = (c => Assert.AreEqual("invalue", c.Parameters[0].Value))
            };

            RunTest(command, MakeParameters("inparm", ParameterDirection.Input),
                    "<tr><td>inparm</td></tr><tr><td>invalue</td></tr>");

            Assert.AreEqual(1, command.ExecuteNonQueryCalls);
        }
Пример #2
0
        [Test] public void ExecutesProcedureWithOutputParameter() {
            var command = new TestCommand {
                NonQueryAction = (c => c.Parameters[0].Value = "outvalue")
            };

            RunTest(command, MakeParameters("outparm", ParameterDirection.Output),
                    "<tr><td>outparm?</td></tr><tr><td>outvalue</td></tr>");

            Assert.AreEqual(1, command.ExecuteNonQueryCalls);
            Assert.AreEqual(1, fixture.TestStatus.Counts.GetCount(TestStatus.Right));
        }
Пример #3
0
        public void MarksRightIfExpectedException()
        {
            fixture = new ExecuteProcedure(db.Object, "myproc", true) {Processor = new Service()};
            var command = new TestCommand {
                NonQueryAction = (c => { throw new ApplicationException();})
            };

            RunTest(command, MakeParameters("inparm", ParameterDirection.Input),
                    "<tr><td>inparm</td></tr><tr><td>invalue</td></tr>");

            Assert.AreEqual(1, command.ExecuteNonQueryCalls);
            Assert.AreEqual(1, fixture.TestStatus.Counts.GetCount(TestStatus.Right));
        }
Пример #4
0
 public void ExecutesProcedureWithNoParameters()
 {
     var command = new TestCommand();
     RunTest(command, null, string.Empty);
     Assert.AreEqual(1, command.ExecuteNonQueryCalls);
 }
Пример #5
0
        [Test] public void MarksWrongIfNoExpectedException() {
            fixture = new ExecuteProcedure(db.Object, "myproc", true) {Processor = new Service()};
            var command = new TestCommand();

            RunTest(command, MakeParameters("inparm", ParameterDirection.Input),
                    "<tr><td>inparm</td></tr><tr><td>invalue</td></tr>");

            Assert.AreEqual(1, command.ExecuteNonQueryCalls);
            Assert.AreEqual(1, fixture.TestStatus.Counts.GetCount(TestStatus.Wrong));
        }