public void TestListAllFilteredContacts() { //Arrange CustomerModel model = new CustomerModel(new FakeUnitOfWork()); //Act IList<CS_Contact> resultList1 = model.ListAllFilteredContacts(1, true); //Assert Assert.AreEqual(2, resultList1.Count); }
/// <summary> /// Filter the persons to Advise grid based on filter type and value /// </summary> public void FilterContactOrEmployee() { try { List<object> GenericList = new List<object>(); using (_customerModel = new CustomerModel()) { using (_employeeModel = new EmployeeModel()) { switch (_view.TypeOfPerson) { case Globals.CallEntry.typeOfPerson.Contact: if (_view.CustomerId.HasValue) GenericList.AddRange(_customerModel.ListAllFilteredContacts(_view.FilteredEmployeeCustomerName, _view.CustomerId.Value)); break; case Globals.CallEntry.typeOfPerson.Employee: GenericList.AddRange(_employeeModel.ListAllFilteredEmployee(_view.FilteredEmployeeCustomerName)); break; case Globals.CallEntry.typeOfPerson.Both: if (_view.CustomerId.HasValue) GenericList.AddRange(_customerModel.ListAllFilteredContacts(_view.FilteredEmployeeCustomerName, _view.CustomerId.Value)); GenericList.AddRange(_employeeModel.ListAllFilteredEmployee(_view.FilteredEmployeeCustomerName)); break; } _view.PersonGridDataSource = GenericList; } } } catch (Exception ex) { Logger.Write(string.Format("An Error has ocurred while trying to load the contact list.\n{0}\n{1}", ex.Message, ex.StackTrace)); _view.DisplayMessage("An Internal Error has ocurred while trying to load the contact list.", false); } }