public void Create_Miss_Required_Album() { FakeDataStore dataStore = MusicStoreEntitiesFactory.GetEmpty(); dataStore.GenerateAndAddGenre(1); dataStore.GenerateAndAddArtist(10); StoreManagerController controller = ControllerFactory.GetWiredUpController((s) => new StoreManagerController(s), store: dataStore); Album album = new Album { Genre = new Genre { Name = "Rock" }, Artist = new Artist { Name = "Men At Work" }, AlbumArtUrl = "/Content/Images/placeholder.gif" }; RedirectToRouteResult result = controller.Create(album) as RedirectToRouteResult; Assert.IsTrue(result.RouteValues.ContainsValue("InvalidRequest")); }
public void Edit_NotExsiting_Album() { FakeDataStore dataStore = MusicStoreEntitiesFactory.GetEmpty(); dataStore.GenerateAndAddGenre(1); dataStore.GenerateAndAddArtist(10); StoreManagerController controller = ControllerFactory.GetWiredUpController((s) => new StoreManagerController(s), store: dataStore); Album album = new Album { Title = "Tình khúc vượt thời gian", Genre = new Genre { Name = "Rock" }, Price = 10M, Artist = new Artist { Name = "Men At Work" }, AlbumArtUrl = "/Content/Images/placeholder.gif" }; RedirectToRouteResult result = controller.Edit(album) as RedirectToRouteResult; Assert.IsTrue(result.RouteValues.ContainsValue("InvalidRequest")); }