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); }
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); }
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); }
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()); }
public void TestGetEmployeeByEmployeeId() { int employeeId = 3; AddressBookModule abMod = new AddressBookModule(); EmployeeView employeeView = abMod.AddressBook.Query().GetEmployeeByEmployeeId(employeeId); Assert.True(employeeView.EmployeeId != null); }
public void TestGetSupplierBySupplierId() { int supplierId = 1; AddressBookModule abMod = new AddressBookModule(); SupplierView supplierView = abMod.AddressBook.Query().GetSupplierBySupplierId(supplierId); Assert.True(supplierView.SupplierId != null); }
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()); }
public void TestGetEmployeesBySupervisorId() { int supervisorId = 1; AddressBookModule abMod = new AddressBookModule(); List <EmployeeView> list = abMod.AddressBook.Query().GetEmployeesBySupervisorId(supervisorId); Assert.True(list.Count > 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); }
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); }
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")); }
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); }