public void TestFindTiersWhenNoResult() { int numberTotalPage = 1; int numberOfRecords = 1; string query = "nicolas"; List <ClientSearchResult> list = new List<ClientSearchResult>(); //mockClientManagement.ExpectAndReturn("GetNumberGroup", 0, query); //mockClientManagement.ExpectAndReturn("GetNumberPerson", 0, query); //mockClientManagement.ExpectAndReturn("GetNumberVillages", 0, query); //mockClientManagement.ExpectAndReturn("SearchGroupByCriteres", list, numberTotalPage, query); //mockClientManagement.ExpectAndReturn("SearchPersonByCriteres", list, numberTotalPage, query); //mockClientManagement.ExpectAndReturn("SearchVillagesByCriteres", list, numberTotalPage, query); mockClientManagement.ExpectAndReturn("GetFoundRecordsNumber",0, query, 2, 1, 1, 1); mockClientManagement.ExpectAndReturn("SearchAllByCriteres", list, query,2, numberTotalPage,1, 1, 1); clientManagement = (ClientManager)mockClientManagement.MockInstance; clientServices = new ClientServices(clientManagement); List<ClientSearchResult> result = clientServices.FindTiers(out numberTotalPage, out numberOfRecords,query, 2, numberTotalPage, 1, 1, 1); Assert.AreEqual(0, result.Count); }
public void TestFindTiersWhenTiersIsPersonAndRecordsAreFound() { int numberTotalPage = 1; int numberOfRecords = 1; string query = "nicolas"; List<ClientSearchResult> listGroup = new List<ClientSearchResult>(); for (int i = 1; i <= 15; i++) { listGroup.Add(new ClientSearchResult(i, "nicolas", OClientTypes.Person, true, 1, "district", "city", false, "OOOOO","test")); } //mockClientManagement.ExpectAndReturn("GetNumberGroup", 0, query); //mockClientManagement.ExpectAndReturn("GetNumberPerson", 0, query); //mockClientManagement.ExpectAndReturn("GetNumberVillages", 0, query); mockClientManagement.ExpectAndReturn("GetFoundRecordsNumber", 15, query, 1, 1, 1, 1); //mockClientManagement.ExpectAndReturn("SearchGroupByCriteres", listGroup, numberTotalPage, query); //mockClientManagement.ExpectAndReturn("SearchPersonByCriteres", listPerson, numberTotalPage, query); //mockClientManagement.ExpectAndReturn("SearchVillagesByCriteres", listVillages, numberTotalPage, query); mockClientManagement.ExpectAndReturn("SearchAllByCriteres", listGroup, query,1, numberTotalPage,1, 1, 1); clientManagement = (ClientManager)mockClientManagement.MockInstance; clientServices = new ClientServices(clientManagement); List<ClientSearchResult> result = clientServices.FindTiers(out numberTotalPage, out numberOfRecords, query, 1, numberTotalPage, 1, 1, 1); Assert.AreEqual(15, result.Count); }