private IQueryable <SolutionApplication> LoadMarketVerticalList() { var list = new List <SolutionApplication>(); for (int i = 1; i <= 5; i++) { var solutionApplication = new SolutionApplication { ID = i, Description = "Desc_" + i, }; list.Add(solutionApplication); } return(list.AsQueryable()); }
public void UpdateMaintainMarketVertical_Successfully(int ID, string descriptionAdd) { var solutionApplicationDto = new SolutionApplicationDto { ID = ID, Description = descriptionAdd, }; var updatedSolutionApplication = new SolutionApplication { ID = ID, Description = descriptionAdd, }; _solutionApplicationRepository.Find(ID).ReturnsForAnyArgs(LoadMarketVerticalList().FirstOrDefault(x => x.ID == solutionApplicationDto.ID)); _solutionApplicationRepository.Update(Arg.Any <SolutionApplication>()).Returns(updatedSolutionApplication); var actualResult = _adminProcessor.SaveMaintainMarketVertical(solutionApplicationDto); Assert.AreEqual(updatedSolutionApplication.ID, actualResult.ID); }
public void AddMaintainMarketVertical_Successfully(int ID, string descriptionAdd) { var solutionApplicationDto = new SolutionApplicationDto { ID = ID, Description = descriptionAdd, }; var addedSolutionApplication = new SolutionApplication { ID = 1, Description = descriptionAdd }; _solutionApplicationRepository.GetAll().ReturnsForAnyArgs(LoadMarketVerticalList()); _solutionApplicationRepository.Add(Arg.Any <SolutionApplication>()).Returns(addedSolutionApplication); var actualResult = _adminProcessor.SaveMaintainMarketVertical(solutionApplicationDto); Assert.AreEqual(addedSolutionApplication.ID, actualResult.ID); }
public void DeleteMaintainMarketVerticals_Successfully(int ID, string userID) { var solutionApplicationDto = new SolutionApplicationDto { ID = ID, }; var updatedSolutionApplication = new SolutionApplication { ID = ID, Active = false }; _solutionApplicationRepository. GetSingle(x => x.ID == solutionApplicationDto.ID). ReturnsForAnyArgs(LoadMarketVerticalList().FirstOrDefault(x => x.ID == solutionApplicationDto.ID)); _solutionApplicationRepository.Update(Arg.Any <SolutionApplication>()).Returns(updatedSolutionApplication); var actualResult = _adminProcessor.DeleteMaintainMarketVerticals(solutionApplicationDto.ID, userID); Assert.AreEqual(actualResult, true); }