[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); }
[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)); }
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)); }
public void ExecutesProcedureWithNoParameters() { var command = new TestCommand(); RunTest(command, null, string.Empty); Assert.AreEqual(1, command.ExecuteNonQueryCalls); }
[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)); }