Example #1
0
        public void TestDeleteAddressBooks()
        {
            List <AddressBook> list = new List <AddressBook>();
            //UnitOfWork unitOfWork = new UnitOfWork();
            AddressBookModule abMod = new AddressBookModule();

            for (int i = 1; i < 10; i++)
            {
                AddressBook addressBook = new AddressBook();
                addressBook.Name = "Test" + i.ToString();
                list.Add(addressBook);
            }
            abMod.AddressBook.CreateAddressBooks(list).Apply();

            list[0].CompanyName = "test";

            abMod.AddressBook.UpdateAddressBook(list[0]).Apply();

            IQueryable <AddressBook> query = abMod.AddressBook.Query().GetAddressBooksByExpression(a => a.Name.Contains("Test"));

            list.Clear();

            foreach (var item in query)
            {
                list.Add(item);
            }

            abMod.AddressBook.DeleteAddressBooks(list).Apply();


            Assert.True(true);
        }
Example #2
0
        public void TestAddandDeleteAddressBook()
        {
            //UnitOfWork unitOfWork = new UnitOfWork();
            AddressBook addressBook = new AddressBook();

            addressBook.FirstName = "James";
            addressBook.LastName  = "Dean";
            addressBook.Name      = "James Dean";


            AddressBookModule abMod = new AddressBookModule();

            abMod.AddressBook.CreateAddressBook(addressBook).Apply();
            IQueryable <AddressBook> query = abMod.AddressBook.Query().GetAddressBooksByExpression(a => a.Name == "James Dean");

            //IQueryable<AddressBook> query = abMod.AddressBook.queryAddressBook;
            //IQueryable<AddressBook> query = unitOfWork.addressBookRepository.GetObjectsQueryable(a => a.Name == "James Dean");

            foreach (var item in query)
            {
                Assert.Equal("James Dean", item.Name);

                //unitOfWork.addressBookRepository.DeleteObject(item);
                abMod.AddressBook.DeleteAddressBook(item);
            }
            abMod.AddressBook.Apply(); //Avoid the thread problem

            //unitOfWork.CommitChanges();

            Assert.True(true);
        }
Example #3
0
        public void TestUpdateAddressBook()
        {
            long addressId = 1;

            AddressBookModule abMod       = new AddressBookModule();
            AddressBook       addressBook = abMod.AddressBook.Query().GetAddressBookByAddressId(addressId);

            addressBook.FirstName = "David2";
            abMod.AddressBook.UpdateAddressBook(addressBook).Apply();


            //unitOfWork.addressBookRepository.UpdateObject(addressBook);
            //unitOfWork.CommitChanges();
            AddressBook addressBook2 = abMod.AddressBook.Query().GetAddressBookByAddressId(addressId);

            string name = addressBook2.FirstName;

            Assert.Equal("David2", name);

            //addressBook = resultTask.Result;
            addressBook2.FirstName = "David";
            abMod.AddressBook.UpdateAddressBook(addressBook).Apply();
            //unitOfWork.addressBookRepository.UpdateObject(addressBook2);
            //unitOfWork.CommitChanges();

            AddressBook addressBook3 = abMod.AddressBook.Query().GetAddressBookByAddressId(addressId);

            name = addressBook3.FirstName;

            Assert.Equal("David", name);
        }
Example #4
0
        public void TestGetSupervisorBySupervisorId()
        {
            int supervisorId        = 1;
            AddressBookModule abMod = new AddressBookModule();
            SupervisorView    view  = abMod.AddressBook.Query().GetSupervisorBySupervisorId(supervisorId);

            Assert.Equal(view.ParentSupervisorName.ToUpper().ToString(), "PAM NISHIMOTO".ToString());
        }
Example #5
0
        public void TestGetEmployeeByEmployeeId()
        {
            int employeeId                 = 3;
            AddressBookModule abMod        = new AddressBookModule();
            EmployeeView      employeeView = abMod.AddressBook.Query().GetEmployeeByEmployeeId(employeeId);

            Assert.True(employeeView.EmployeeId != null);
        }
Example #6
0
        public void  TestGetSupplierBySupplierId()
        {
            int supplierId                 = 1;
            AddressBookModule abMod        = new AddressBookModule();
            SupplierView      supplierView = abMod.AddressBook.Query().GetSupplierBySupplierId(supplierId);

            Assert.True(supplierView.SupplierId != null);
        }
Example #7
0
        public void TestGetCarrierByCarrierId()
        {
            int carrierId = 1;

            AddressBookModule abMod       = new AddressBookModule();
            CarrierView       carrierView = abMod.AddressBook.Query().GetCarrierByCarrierId(carrierId);

            Assert.Equal("United Parcel Service", carrierView.CarrierName.ToString());
        }
Example #8
0
        public void TestGetEmployeesBySupervisorId()
        {
            int supervisorId        = 1;
            AddressBookModule abMod = new AddressBookModule();

            List <EmployeeView> list = abMod.AddressBook.Query().GetEmployeesBySupervisorId(supervisorId);


            Assert.True(list.Count > 0);
        }
Example #9
0
        public void TestGetBuyerByBuyerId()
        {
            int buyerId = 1;

            AddressBookModule abMod = new AddressBookModule();

            BuyerView buyerView = abMod.AddressBook.Query().GetBuyerByBuyerId(buyerId);

            Assert.Equal("Regional Purchasing Clerk", buyerView.BuyerTitle);
        }
Example #10
0
        public void TestGetPhonesByAddressId()
        {
            long addressId          = 1;
            AddressBookModule abMod = new AddressBookModule();
            List <Phone>      list  = abMod.AddressBook.Query().GetPhonesByAddressId(addressId);

            List <string> intCollection = new List <string>();

            foreach (var item in list)
            {
                output.WriteLine($"{item.PhoneNumber}");
                intCollection.Add(item.PhoneNumber);
            }
            bool results = intCollection.Any(s => s.Contains("401-4333"));

            Assert.True(results);
        }
Example #11
0
        public void TestGetAddressBooks()
        {
            //int addressId = 1;

            //UnitOfWork unitOfWork = new UnitOfWork();
            AddressBookModule  abMod        = new AddressBookModule();
            List <AddressBook> addressBooks = abMod.AddressBook.Query().GetAddressBookByName("David");

            IList <string> list = new List <string>();

            foreach (var item in addressBooks)
            {
                output.WriteLine($"{item.Name}");
                list.Add(item.Name.ToUpper());
            }
            Assert.True(list.Contains("DAVID NISHIMOTO"));
        }
Example #12
0
        public void TestGetEmailsByAddressId()
        {
            long addressId          = 1;
            AddressBookModule abMod = new AddressBookModule();
            List <Email>      list  = abMod.AddressBook.Query().GetEmailsByAddressId(addressId);

            List <string> intCollection = new List <string>();

            foreach (var item in list)
            {
                output.WriteLine($"{item.Email1}");
                intCollection.Add(item.Email1);
            }
            bool results = intCollection.Any(s => s.Contains("*****@*****.**"));

            Assert.True(results);
        }