public void SortAccessorsInRightOrder()
        {
            //Prepare
            DbParameterAccessor[] accessorsToOrder = new DbParameterAccessor[4];
            accessorsToOrder[0] = new DbParameterAccessor(new System.Data.SqlClient.SqlParameter(), typeof(string), 1, "String");
            accessorsToOrder[3] = new DbParameterAccessor(new System.Data.SqlClient.SqlParameter(), typeof(string), 3, "String");
            accessorsToOrder[2] = new DbParameterAccessor(new System.Data.SqlClient.SqlParameter(), typeof(string), 5, "String");
            accessorsToOrder[1] = new DbParameterAccessor(new System.Data.SqlClient.SqlParameter(), typeof(string), 7, "String");


            //Execute
            DbParameterAccessor[] resultingAccessors = ExecuteProcedure.SortAccessors(accessorsToOrder);

            //Verify
            Assert.AreEqual(1, resultingAccessors[0].Position);
            Assert.AreEqual(3, resultingAccessors[1].Position);
            Assert.AreEqual(5, resultingAccessors[2].Position);
            Assert.AreEqual(7, resultingAccessors[3].Position);
        }
        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 SetUp()
 {
     db = new Mock<IDbEnvironment>();
     fixture = new ExecuteProcedure(db.Object, "myproc") {Processor = new Service()};
 }
        [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));
        }