예제 #1
0
        public void DeleteStaffTest()
        {
            MasterDataLinqBroker target = new MasterDataLinqBroker(); // TODO: Initialize to an appropriate value
            IStaff staff = target.GetStaffById(4); // TODO: Initialize to an appropriate value
            string deletedBy = "Test case"; // TODO: Initialize to an appropriate value
            bool expected = true; // TODO: Initialize to an appropriate value
            bool actual;
            actual = target.DeleteStaff(staff, deletedBy);
            Assert.AreEqual(expected, actual);

            target = new MasterDataLinqBroker();
            //IStaff updated = target.GetStaffById(4);
            IStaff updated = Context.Staffs.SingleOrDefault(s => s.StaffID == 4);

            Assert.AreEqual(actual, updated.IsDeleted);
            Assert.AreEqual(actual, true);
            Assert.AreEqual(updated.IsDeleted, true);
            //Assert.AreEqual(staff.DeletedBy, "Test case");
            //Assert.AreEqual(updated.DeletedBy, "Test case");

            //Assert.Inconclusive("Verify the correctness of this test method.");
        }
예제 #2
0
        public void GetStaffByIdTest()
        {
            MasterDataLinqBroker target = new MasterDataLinqBroker(); // TODO: Initialize to an appropriate value
            int staffId = 5; // TODO: Initialize to an appropriate value
            IStaff expected = Context.Staffs.SingleOrDefault(s => s.StaffID == 5); // TODO: Initialize to an appropriate value
            IStaff actual;
            actual = target.GetStaffById(staffId);
            //Assert.AreEqual(expected, actual);

            Assert.AreEqual(expected.StaffID, actual.StaffID);
            Assert.AreEqual(expected.InitialName, actual.InitialName);
            Assert.AreEqual(expected.FirstName, actual.FirstName);
            Assert.AreEqual(expected.LastName, actual.LastName);
            Assert.AreEqual(expected.DateofBirth, actual.DateofBirth);
            Assert.AreEqual(expected.Gender, actual.Gender);
            Assert.AreEqual(expected.PostCode, actual.PostCode);
            Assert.AreEqual(expected.Address, actual.Address);
            Assert.AreEqual(expected.Province, actual.Province);
            Assert.AreEqual(expected.PhoneNo, actual.PhoneNo);
            Assert.AreEqual(expected.IsDeleted, actual.IsDeleted);
            Assert.AreEqual(expected.UserGuid, actual.UserGuid);

            Assert.AreEqual(expected.RowGuid, actual.RowGuid);

            //Assert.Inconclusive("Verify the correctness of this test method.");
        }
예제 #3
0
        public void SaveStaffTest()
        {
            MasterDataLinqBroker target = new MasterDataLinqBroker(); // TODO: Initialize to an appropriate value
            IStaff staff = target.GetStaffById(5); // TODO: Initialize to an appropriate value
            bool expected = true; // TODO: Initialize to an appropriate value
            bool actual;

            int phone = new Random().Next(23421, 999999);
            staff.PhoneNo = phone.ToString();

            actual = target.SaveStaff(staff, "unit test");
            Assert.AreEqual(expected, actual);

            target = new MasterDataLinqBroker();
            IStaff updated = target.GetStaffById(5);

            Assert.AreEqual(updated.PhoneNo, staff.PhoneNo);
            Assert.AreEqual(updated.PhoneNo, phone.ToString());
            Assert.AreEqual(staff.PhoneNo, phone.ToString());
            //Assert.Inconclusive("Verify the correctness of this test method.");
        }