Exemplo n.º 1
0
        public void Details_ReturnsCorrectView_True()
        {
            //Arrange
            PatronsController controller = new PatronsController();

            //Act
            ActionResult detailView = controller.Details(1);

            //Assert
            Assert.IsInstanceOfType(detailView, typeof(ViewResult));
        }
Exemplo n.º 2
0
        public void UpdateForm_ReturnsCorrectView_True()
        {
            //Arrange
            PatronsController controller = new PatronsController();

            //Act
            ActionResult updateView = controller.UpdateForm(1);

            //Assert
            Assert.IsInstanceOfType(updateView, typeof(ViewResult));
        }
Exemplo n.º 3
0
        public void Index_ReturnsCorrectView_True()
        {
            //Arrange
            PatronsController controller = new PatronsController();

            //Act
            ActionResult indexView = controller.Index();

            //Assert
            Assert.IsInstanceOfType(indexView, typeof(ViewResult));
        }
Exemplo n.º 4
0
        public void Details_HasCorrectModelType_PatronList()
        {
            //Arrange
            PatronsController controller   = new PatronsController();
            IActionResult     actionResult = controller.Details(1);
            ViewResult        detailView   = controller.Details(1) as ViewResult;

            //Act
            var result = detailView.ViewData.Model;

            //Assert
            Assert.IsInstanceOfType(result, typeof(Dictionary <string, object>));
        }
Exemplo n.º 5
0
        public void Index_HasCorrectModelType_PatronList()
        {
            //Arrange
            PatronsController controller   = new PatronsController();
            IActionResult     actionResult = controller.Index();
            ViewResult        indexView    = controller.Index() as ViewResult;

            //Act
            var result = indexView.ViewData.Model;

            //Assert
            Assert.IsInstanceOfType(result, typeof(List <Patron>));
        }
 public void Initialize()
 {
     patronRepo  = new InMemoryRepository <Patron>();
     holdingRepo = new InMemoryRepository <Holding>();
     controller  = new PatronsController(patronRepo, holdingRepo);
 }
 public PatronsControllerTest(DbContextFixture fixture)
 {
     fixture.Seed();
     context    = new LibraryContext(fixture.ContextOptions);
     controller = new PatronsController(context);
 }