public void IndexTest() { //Arrange FakeGenreBL fake = new FakeGenreBL(); GenresController controller = new GenresController(fake); controller.testCase = true; //Act ViewResult result = controller.Index() as ViewResult; //Assert Assert.AreEqual(result.ViewName, "Index"); }
public void NotTestCase() { //Arrange FakeGenreBL fake = new FakeGenreBL(); GenresController controller = new GenresController(fake); //var result = (VideoGame)((ViewResult)controller.Details(1)).Model; // Act controller.testCase = false; //controller.Index(); // Assert Assert.AreEqual(false, controller.testCase); }
public void Dispose() { //Arrange FakeGenreBL fake = new FakeGenreBL(); GenresController controller = new GenresController(fake); controller.testCase = true; //var result = (VideoGame)((ViewResult)controller.Details(1)).Model; // Act controller.Dispose(); // Assert Assert.IsTrue(true); }
public void CreateView() { //Arrange FakeGenreBL fake = new FakeGenreBL(); GenresController controller = new GenresController(fake); controller.testCase = true; //var result = (VideoGame)((ViewResult)controller.Details(1)).Model; // Act ViewResult result = controller.Create() as ViewResult; // Assert Assert.AreEqual("Create", result.ViewName); }
public void DetailInValidId() { //Arrange FakeGenreBL fake = new FakeGenreBL(); GenresController controller = new GenresController(fake); controller.testCase = true; //var result = (VideoGame)((ViewResult)controller.Details(1)).Model; // Act ViewResult result = controller.Details(300) as ViewResult; // Assert Assert.AreEqual("Error", result.ViewName); }
public void DeleteConfirmedValidId() { //Arrange FakeGenreBL fake = new FakeGenreBL(); //fake.createGenres(); GenresController controller = new GenresController(fake); controller.testCase = true; //var result = (VideoGame)((ViewResult)controller.Details(1)).Model; // Act System.Web.Mvc.RedirectToRouteResult actual = (System.Web.Mvc.RedirectToRouteResult)controller.DeleteConfirmed(1); // Assert Assert.AreEqual("Index", actual.RouteValues["action"]); }
public void ValidEditSave() { //Arrange FakeGenreBL fake = new FakeGenreBL(); GenresController controller = new GenresController(fake); controller.testCase = true; //var result = (VideoGame)((ViewResult)controller.Details(1)).Model; // Act Genre fps = new Genre { Name = "FPS", Description = "Men's romance" }; ViewResult result = controller.Edit(fps) as ViewResult; // Assert Assert.AreEqual("Edit", result.ViewName); }
public void CreateInvalid() { //Arrange FakeGenreBL fake = new FakeGenreBL(); GenresController controller = new GenresController(fake); controller.testCase = true; Genre test = new Genre { GenreId = 30, Name = "test", Description = "test" }; //var result = (VideoGame)((ViewResult)controller.Details(1)).Model; // Act ViewResult result = controller.Create(test) as ViewResult; // Assert Assert.AreEqual("Create", result.ViewName); }