public void DepartmentTests()
        {
            // Open a SqlConnection object using the active transaction
            using (SqlConnection conn = new SqlConnection(connectionString))
            {
                conn.Open();

                DepartmentSqlDAL   testDAL  = new DepartmentSqlDAL(connectionString);
                IList <Department> testList = new List <Department>();
                testList = testDAL.GetDepartments();
                int savecount = testList.Count;
                Assert.AreNotEqual(0, testList.Count, "There should be Initial Data");

                Department testDepartment = new Department();
                testDepartment.Name = "alkjfagjhasivs";
                departmentId        = testDAL.CreateDepartment(testDepartment);
                Assert.AreNotEqual(0, departmentId, "Deparment ID should be greater than 0");

                testDepartment = testDAL.GetADepartment(departmentId);
                Assert.AreEqual(departmentId, testDepartment.Id, "Department IDs should match");
                Assert.AreEqual("alkjfagjhasivs", testDepartment.Name, "Departname should be \"alkjfagjhasivs\"");

                testList = testDAL.GetDepartments();
                Assert.AreEqual(savecount + 1, testList.Count, "List should have 1 more element");

                testDepartment.Name = "zzhzhzhzhzhzhz";
                testDepartment.Id   = departmentId;
                bool status = testDAL.UpdateDepartment(testDepartment);
                Assert.AreEqual(true, status);
                testDepartment = testDAL.GetADepartment(departmentId);
                Assert.AreEqual("zzhzhzhzhzhzhz", testDepartment.Name);
            }
        }
Пример #2
0
        public void UpdateDepartmentTest()
        {
            Department testdept = new Department();

            testdept.Id = 3;

            testdept.Name = "steve";

            Assert.IsTrue(test.UpdateDepartment(testdept));
        }
Пример #3
0
        public void UpdateDepartmentTest()
        {
            DepartmentSqlDAL updateDeptTest = new DepartmentSqlDAL(connectionString);
            Department       testUpdateDept = new Department();

            testUpdateDept.Name = "TestDepartment3";
            testUpdateDept.Id   = departmentCode;
            bool didWork = updateDeptTest.UpdateDepartment(testUpdateDept);

            Assert.IsTrue(didWork);
        }
Пример #4
0
        public void UpdateDepartmentTest()
        {
            DepartmentSqlDAL departmentSqlDAL = new DepartmentSqlDAL(connectionString);
            Department       department       = new Department();

            department.Name = "TestDepartment";
            department.Id   = id;
            bool result = departmentSqlDAL.UpdateDepartment(department);

            Assert.AreEqual(true, result);
        }
        public void UpdateDepartmentTests()
        {
            DepartmentSqlDAL deptDal = new DepartmentSqlDAL(connectionString);
            Department       dept    = new Department();

            dept.Id   = 4;
            dept.Name = "Logistics";
            bool updateWorked = deptDal.UpdateDepartment(dept);

            Assert.AreEqual(true, updateWorked);
        }
        public void UpdateDept()
        {
            DepartmentSqlDAL deptSqlDal = new DepartmentSqlDAL(connectionString);
            Department       dept       = new Department
            {
                Name = "Test Dept",
                Id   = deptId
            };
            bool didWork = deptSqlDal.UpdateDepartment(dept);

            Assert.AreEqual(true, didWork);
        }
Пример #7
0
        public void UpdateDepartmentsTests()
        {
            _department.Name = "New Name";

            _departmentItem.UpdateDepartment(_department);

            Department getDepartment = _departmentItem.GetSinlgeDepartment(_department.Id);

            Assert.AreEqual(_department.Name, getDepartment.Name);

            Assert.AreEqual(_department.Id, getDepartment.Id);
        }
Пример #8
0
        public void UpdateDepartmentTest()
        {
            DepartmentSqlDAL departmentSqlDAL = new DepartmentSqlDAL(connectionString);
            Department       department       = new Department
            {
                Name = "The Next Department",
                Id   = 2
            };

            bool didItWork = departmentSqlDAL.UpdateDepartment(department);

            Assert.IsTrue(didItWork);
        }
Пример #9
0
        public void UpdateDepartmentsTest()
        {
            DepartmentSqlDAL departmentDAL = new DepartmentSqlDAL(connectionString);
            Department       department    = new Department
            {
                Name = "Kyle's Place",
                Id   = 1
            };

            bool departmentID = departmentDAL.UpdateDepartment(department);

            Assert.IsTrue(departmentID);
        }
Пример #10
0
        public void UpdateDepartmentTest()
        {
            DepartmentSqlDAL testDept = new DepartmentSqlDAL(connectionString);
            Department       myDept   = new Department
            {
                Id   = 5,
                Name = "NewTestDept"
            };

            bool isUpdated = testDept.UpdateDepartment(myDept);

            Assert.IsTrue(isUpdated);
        }
Пример #11
0
        public void UpdateDepartmentTest()
        {
            DepartmentSqlDAL departmentDAL     = new DepartmentSqlDAL(connectionString);
            Department       departmentTestObj = new Department
            {
                Id   = id,
                Name = "Shoe",
            };

            bool didWork = departmentDAL.UpdateDepartment(departmentTestObj);

            Assert.AreEqual(true, didWork);
        }
Пример #12
0
        public void DepartmentTest()
        {
            DepartmentSqlDAL  deptTest01 = new DepartmentSqlDAL(connectionString);
            List <Department> happyList  = deptTest01.GetDepartments();

            Department goodDept02 = new Department();

            goodDept02.Id   = 1;
            goodDept02.Name = "yeah";
            deptTest01.UpdateDepartment(goodDept02);

            Assert.AreEqual(departmentCount + 3, happyList.Count);
            Assert.AreEqual("yeah", deptTest01.GetDepartments(1).Name);
        }
        public void UpdateDepartmentTest()
        {
            //Arrange
            DepartmentSqlDAL departmentDAL = new DepartmentSqlDAL(connectionString);

            Department updatedDepartment = new Department()
            {
                Id   = newDaprtmentID,
                Name = "Playsation"
            };

            bool wasSuccessful = departmentDAL.UpdateDepartment(updatedDepartment);

            //Assert
            Assert.AreEqual(true, wasSuccessful);
        }
        public void UpdateDepartment()
        {
            DepartmentSqlDAL departments = new DepartmentSqlDAL(connectionString);

            Department ABCD = new Department()
            {
                Name = "ABCD",
                Id   = 2
            };

            bool isTrue = departments.UpdateDepartment(ABCD);
            List <Department> updatedDepartments = departments.GetDepartments();

            Assert.AreEqual("ABCD", updatedDepartments[0].Name);
            Assert.AreEqual(true, isTrue);
        }
        public void UpdateDepartmentTest()
        {
            //Arrange
            Department updatedDept = new Department
            {
                Id   = departmentId,
                Name = "Updated Department"
            };
            DepartmentSqlDAL dal = new DepartmentSqlDAL(ConnectionString);

            //Act
            bool result = dal.UpdateDepartment(updatedDept);

            //Assert
            Assert.IsTrue(result);
        }
Пример #16
0
        private void UpdateDepartment()
        {
            int        departmentId      = CLIHelper.GetInteger("Which department are you updating?");
            string     updatedName       = CLIHelper.GetString("Provide the new name:");
            Department updatedDepartment = new Department
            {
                Id   = departmentId,
                Name = updatedName
            };
            DepartmentSqlDAL dal    = new DepartmentSqlDAL(DatabaseConnection);
            bool             result = dal.UpdateDepartment(updatedDepartment);

            if (result)
            {
                Console.WriteLine("*** SUCCESS ***");
            }
            else
            {
                Console.WriteLine("*** DID NOT UPDATE ***");
            }
        }
Пример #17
0
        public void TestUpdateDepartment()
        {
            DepartmentSqlDAL testUpdate        = new DepartmentSqlDAL(connectionString);
            Department       updatedDepartment = new Department();

            updatedDepartment.Id   = 1;
            updatedDepartment.Name = "UpdatedDepartmentName";
            testUpdate.UpdateDepartment(updatedDepartment);
            string altereddepartment = "";

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                SqlCommand cmd;
                connection.Open();

                cmd = new SqlCommand("SELECT name FROM department WHERE department_id = 1;", connection);

                altereddepartment = (string)cmd.ExecuteScalar();
            }

            Assert.AreEqual(updatedDepartment.Name, altereddepartment);
        }
Пример #18
0
        public void UpdateDepartmentTest()
        {
            DepartmentSqlDAL departmentSqldal = new DepartmentSqlDAL(connectionString);

            List <Department> departments = departmentSqldal.GetDepartments();

            //int testDepartmentID = 0;
            Department testDepartment = new Department();

            foreach (Department thisDepartment in departments)
            {
                if (thisDepartment.Name == "Test Department")
                {
                    testDepartment = thisDepartment;
                }
            }

            testDepartment.Name = "Altered Name";

            bool didUpdate = departmentSqldal.UpdateDepartment(testDepartment);

            Assert.AreEqual(true, didUpdate);
        }