public void DetailsNoIdLoadsError() { //act// ViewResult result = (ViewResult)controller.Details(null); //assert// Assert.AreEqual("Error", result.ViewName); }
public void DetailsNoId() { //act var result = (ViewResult)controller.Details(null); //assert Assert.AreEqual("Error", result.ViewName); }
public void DetailsValidIdLoadsView() { // act var result = (ViewResult)albumsController.Details(10).Result; // assert Assert.AreEqual("Details", result.ViewName); }
public void AlbumControllerDetails() { var albumController = new AlbumsController(null, null); var result = albumController.Details(1); Assert.IsNotNull(result); }
public void DetailReturnsErrorWithInvalidId() { //arrange Fakes.FakeAlbumDAL DAL = new Fakes.FakeAlbumDAL(); AlbumsController controller = new AlbumsController(DAL); //Act ViewResult result = controller.Details(10000) as ViewResult; //Assert Assert.AreEqual("Error", result.ViewName); }
public void DetailUsesDAL() { //arrange Fakes.FakeAlbumDAL DAL = new Fakes.FakeAlbumDAL(); AlbumsController controller = new AlbumsController(DAL); //Act controller.Details(5); //Assert Assert.AreEqual(5, DAL.albumId); }
public void IsModelDetailsIsInstanceOfAlbum() { // Arrange AlbumsController controller = new AlbumsController(); // Act ViewResult result = controller.Details(37) as ViewResult; Album xd = (Album)result.Model; // Assert Assert.IsNotNull(result); Assert.IsInstanceOf(typeof(Album), result.Model); }
public async Task AlbumsDetailsShouldReturnViewWithCorrectModelWithValidId() { // Arrange var albumService = this.AlbumServiceMock(); var controller = new AlbumsController(albumService.Object); // Act var result = await controller.Details(1); // Assert result.Should().BeOfType <ViewResult>(); var albumModel = result.As <ViewResult>().Model.As <AlbumDetailsServiceModel>(); albumModel.Should().Match(c => c.As <AlbumDetailsServiceModel>().Id == 1); }
public async Task AlbumDetailsShouldReturnNotFoundWithInvalidId() { // Arrange var albumService = this.AlbumServiceMock(); var controller = new AlbumsController(albumService.Object); // Act var result = await controller.Details(4); // Assert var redirectToActionResult = Assert.IsType <RedirectToActionResult>(result); result .Should() .BeOfType <RedirectToActionResult>(); Assert.Equal("NotFoundPage", redirectToActionResult.ActionName); }