public void IndexLoadsIndex() { // Act ViewResult result = controller.Index() as ViewResult; // Assert Assert.IsNotNull(result); // check if we get a View back when we call it }
public void IndexLoadsValid() { // act ViewResult result = controller.Index() as ViewResult; // assert Assert.IsNotNull(result); }
public void IndexViewLoads() { // Arrange // Act ViewResult result = controller.Index() as ViewResult; // Assert Assert.IsNotNull(result); }
public void IndexFails() { //Mock<IStoreManagerRepository> mock = new Mock<IStoreManagerRepository>(); //StoreManagerController controller = new StoreManagerController(mock.Object); //ViewResult result = controller.Index() as ViewResult; //Assert.IsNotNull(result); var actual = (List <Album>)controller.Index().Model; CollectionAssert.AreNotEqual(albums, actual); }
public void IndexFails() { Mock <IStoreManagerRepository> mock = new Mock <IStoreManagerRepository>(); StoreManagerController controller = new StoreManagerController(mock.Object); ViewResult result = controller.Index() as ViewResult; Assert.IsNotNull(result); }
public void Index() { // Arrange StoreManagerController controller = new StoreManagerController(); // Act ViewResult result = controller.Index() as ViewResult; // Assert Assert.IsNotNull(result); }
public void IndexPass() { // Arrange Mock <IStoreManagerRepository> mock = new Mock <IStoreManagerRepository>(); Mock <IArtistRepository> artistMock = new Mock <IArtistRepository>(); Mock <IGenreRepository> genreMock = new Mock <IGenreRepository>(); List <Album> albums = new List <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 } }; mock.Setup(m => m.Albums).Returns(albums.AsQueryable()); // 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 var actual = (List <Album>)controller.Index().Model; // Assert CollectionAssert.AreEqual(albums, actual); //Assert.IsInstanceOfType(actual, List<Album>); }