public ActionResult Edit(Nwd.BackOffice.Model.Album album) { AlbumRepository albumRepository = new AlbumRepository(); if (ModelState.IsValid) { albumRepository.EditAlbum(HttpContext.Server, album); return RedirectToRoute("list"); } else { return View(album); } }
public void Edit_Album() { AlbumRepository repo = new AlbumRepository(); HttpServerUtilityBase server = Mock.Of<HttpServerUtilityBase>(); Album album = repo.CreateAlbum( new BackOffice.Model.Album { Duration = TimeSpan.FromHours( 2 ), Title = RandomName(), Artist = new BackOffice.Model.Artist { Name = RandomName() }, ReleaseDate = DateTime.UtcNow, Type = "Pop-Rock" }, server ); Assert.That( album.Id, Is.GreaterThan( 0 ) ); album.Title = "New Title"; album = repo.EditAlbum( server, album ); Assert.That( album.Title == "New Title" ); }