public void DetailsValidAlbum() { // act var actual = (Album)controller.Details(1).Model; // assert Assert.AreEqual(albums.ToList()[0], actual); }
public void DetailsValidAlbum() { //act var actual = (Album)controller.Details(1).Model; // we pass (1) because we know this id lives in our mock data // assert Assert.AreEqual(albums.ToList()[0], actual); // we just use Assert because we are comparing 2 albums }
public void DetailsPass() { // Arrange Mock <IStoreManagerRepository> mock = new Mock <IStoreManagerRepository>(); Mock <IArtistRepository> artistMock = new Mock <IArtistRepository>(); Mock <IGenreRepository> genreMock = new Mock <IGenreRepository>(); Album album = new Album { AlbumId = 1, Title = "Album 1", Price = 9 }; mock.Setup(m => m.Get(1)).Returns(album); // move this to setup so mock data can be used by all tests //mock.Setup(m => m.Albums).Returns(new Album[] //{ // new Album { AlbumId = 1, Title = "Album 1", Price = 9 }, // new Album { AlbumId = 2, Title = "Album 2", Price = 10 }, // new Album { AlbumId = 2, Title = "Album 3", Price = 8 } //}.AsQueryable()); StoreManagerController controller = new StoreManagerController(mock.Object); // Act Album actual = (Album)controller.Details(1).Model; // Assert Assert.AreEqual(album, actual); }
public void Details_NotFound() { StoreManagerController controller = new StoreManagerController(); ViewResult result = controller.Details(999) as ViewResult; Assert.IsNull(result); }
public void Details_Found() { // Arrange StoreManagerController controller = new StoreManagerController(); // Act ViewResult result = controller.Details(388) as ViewResult; // Assert Assert.IsNotNull(result, "Details Passed"); }
public void Details() { createTestObject(); // Arrange StoreManagerController controller = new StoreManagerController(); // Act ViewResult result = controller.Details(beanBag.id) as ViewResult; // Assert Assert.IsNotNull(result); deleteTestObject(beanBag.id); }