public async Task <WebsiteProxy> Update(WebsiteProxy websiteProxy) { if (websiteProxy.Id == 0) { throw new NotFoundError($"Update Failed. Website {websiteProxy.Id} not provided"); } WebsiteValidator.ValidateOnUpdateOrCreate(websiteProxy); var updatedObject = await WebsiteRepository.Update(websiteProxy); if (updatedObject is null) { throw new NotFoundError($"Update Failed. Website with id {websiteProxy.Id} not found"); } return(updatedObject); }
public void TestUpdatedWebsite() { Website response; var id = WebsiteWaldo.GetAnExistingIdByName(websiteRepo, "Facebook"); var website = new WebsiteBuilder(id).FacebookWebsite().UpdateName("Facebook Updated").Build(); try { response = websiteRepo.Update(id, website); websiteRepo.Save(); } catch (Exception e) { Console.WriteLine(e); Assert.Fail(); throw; } Assert.IsNotNull(response); Assert.AreEqual(website.CompanyName, response.CompanyName); Assert.AreEqual(website.WebsiteUrl, response.WebsiteUrl); }