public HttpResponseMessage Delete(DeleteSiteModel deleteSiteModel)
 {
     var site = repository.Get(deleteSiteModel.Id);
     repository.Delete(site);
     var response = Request.CreateResponse(HttpStatusCode.OK);
     return response;
 }
Beispiel #2
0
 public void CanDeleteSite()
 {
     //Arrange - Add the site to the repository.
     repository.Create(testSite);
     var siteToBeDeleted = repository.Get().First();
     //Act - Invoke the controller's delete method.
     var deleteSiteModel = new DeleteSiteModel { Id = siteToBeDeleted.Id };
     var response = controller.Delete(deleteSiteModel);
     //Assert - Make sure that the site and all things that were attached to it aer no longer in the repository-like.
     Assert.IsNull(repository.Get(siteToBeDeleted.Id));
     Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
 }