示例#1
0
        public void DeleteManager()
        {
            var     list    = new ManagerList();
            Manager manager = new Manager();

            manager.Name          = "LUO";
            manager.StreetAddress = "397 4th Ave S";
            manager.City          = "Saint Cloud";
            manager.State         = "MN";
            manager.ZipCode       = "56301";

            var newID = list.InsertManager(manager);

            Assert.IsTrue(null != newID, "Insert member Fail");

            var success = list.DeleteManager(newID.Value);

            Assert.IsTrue(success, "Delete Fail");

            //delete a manager who exists in the DB
            int managerID = 42;
            var result    = list.DeleteManager(managerID);

            Assert.IsFalse(result, "Failed to delete a manager who exists in the DB.");

            //delete a manager who does exist in the DB
            managerID = 0;
            result    = list.DeleteManager(managerID);
            Assert.IsFalse(result, "Failed to execute an operation of deleting a manager who does not exist in the DB");

            //delete a manager who does exist in the DB
            managerID = 100000;
            result    = list.DeleteManager(managerID);
            Assert.IsFalse(result, "Failed to execute an operation of deleting a manager who does not exist in the DB");
        }
示例#2
0
        public void InsertManager()
        {
            var list = new ManagerList();

            //complete data
            var manager = new Manager();

            manager.Name          = "manager02";
            manager.StreetAddress = "124 77th Ave S";
            manager.State         = "MN";
            manager.City          = "Saint Cloud";
            manager.ZipCode       = "12345";

            var newManagerId = list.InsertManager(manager);

            //fields are null
            manager      = new Manager();
            newManagerId = list.InsertManager(manager);
            Assert.IsFalse(null != newManagerId, "feilds are null.");

            //object is null
            newManagerId = list.InsertManager(null);
            Assert.IsFalse(null != newManagerId, "adding a null object.");

            //boundary data
            manager               = new Manager();
            manager.Name          = "";
            manager.StreetAddress = "";
            manager.State         = "";
            manager.City          = "";
            manager.ZipCode       = "";
            newManagerId          = list.InsertManager(manager);
            Assert.IsFalse(null != newManagerId, "all field are empty.");

            //add a manager who does exists in the DB
            manager               = new Manager();
            manager.Name          = "manager01";
            manager.StreetAddress = "123 77th Ave S";
            manager.State         = "MN";
            manager.City          = "Saint Cloud";
            manager.ZipCode       = "56301";
            newManagerId          = list.InsertManager(manager);
            Assert.IsFalse(null != newManagerId, "failed to execute an operation of adding a manager who does exist in the DB.");
            Assert.IsFalse(null != newManagerId, "insert manager failed.");
        }