コード例 #1
0
        public bool addPet(string name, string owner, string sex, int type)
        {
            List <Parametro> parametros = new List <Parametro>();

            parametros.Add(new Parametro()
            {
                name = "_name", value = name
            });
            parametros.Add(new Parametro()
            {
                name = "_owner", value = owner
            });
            parametros.Add(new Parametro()
            {
                name = "_sex", value = sex
            });
            parametros.Add(new Parametro()
            {
                name = "_type", value = type.ToString()
            });

            MySqlDataReader reader = ExecuteProcedure.executeStoreProcedure("addPet", parametros);

            if (reader.Read())
            {
                return(true);
            }
            else
            {
                return(true);
            }
        }
コード例 #2
0
 [SetUp] public void SetUp()
 {
     db      = new Mock <IDbEnvironment>();
     fixture = new ExecuteProcedure(db.Object, "myproc")
     {
         Processor = new Service()
     };
 }
コード例 #3
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));
        }
コード例 #4
0
        public List <string>[] selectPetsProcedure()
        {
            List <string>[] list = new List <string> [4];
            list[0] = new List <string>(); //PetID
            list[1] = new List <string>(); //Name
            list[2] = new List <string>(); //owner
            list[3] = new List <string>(); //nameType
            MySqlDataReader reader = ExecuteProcedure.ExecuteSPWithoutParameters("SelectAllPets");

            while (reader.Read())
            {
                list[0].Add(reader["PetID"] + "");
                list[1].Add(reader["Name"] + "");
                list[2].Add(reader["owner"] + "");
                list[3].Add(reader["nameType"] + "");
            }
            return(list);
        }
コード例 #5
0
        public void SortAccessorsInRightOrder()
        {
            //Prepare
            var accessorsToOrder = new DbParameterAccessor[4];

            accessorsToOrder[0] = new DbParameterAccessor(new SqlParameter(), typeof(string), 1, "String");
            accessorsToOrder[3] = new DbParameterAccessor(new SqlParameter(), typeof(string), 3, "String");
            accessorsToOrder[2] = new DbParameterAccessor(new SqlParameter(), typeof(string), 5, "String");
            accessorsToOrder[1] = new DbParameterAccessor(new 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);
        }