Пример #1
0
        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);
            }
        }
Пример #2
0
        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" );
        }