public void AddingGalleryContent() { //Assemble var controller = new ManageMediaGalleryController(s_repo, s_mapRepo, s_mediaRepo); var content = new MediaGalleryContent { Title = "Added", Content = "<b>Added</b>" }; //Act var result = controller.Create(content).GetAwaiter().GetResult() as ViewResult; var items = s_repo.GetListOfItemsAsync(ContentType.MediaGallery.ToString()).GetAwaiter().GetResult(); var targetItem = items.Where((i) => i.Title == "Added").FirstOrDefault(); //Assert Assert.IsNotNull(targetItem, "Item not found after adding"); }
public void AddingSimpleContent() { //Assemble var controller = new ManageSimpleController(s_repo, s_mapRepo); SimpleContent content = new SimpleContent { Title = "Added", Content = "<b>Added</b>" }; //Act var result = controller.Create(content).GetAwaiter().GetResult() as ViewResult; var items = s_repo.GetListOfItemsAsync(ContentType.Simple.ToString()).GetAwaiter().GetResult(); var targetItem = items.Where((i) => i.Title == "Added").FirstOrDefault(); //Assert Assert.AreEqual <string>("Confirm", result.ViewName, "Confirmation view not returned"); Assert.IsNotNull(targetItem, "Item not found after adding"); }