Ejemplo n.º 1
0
        public void DetailsTest()
        {
            _mockRoomRepo.Setup(x => x.Find(1)).Returns(new Room());
            var result = _roomsController.Details(1) as ViewResult;

            Assert.AreEqual("Details", result.ViewName);
        }
Ejemplo n.º 2
0
        public void Details_RoomExists_ReturnsViewResultWithRoom()
        {
            // Act
            var result = controller.Details(2) as ViewResult;
            var room   = result.Model as Room;
            var roomId = room.Id;

            // Assert
            Assert.InRange <int>(roomId, 1, 2);
        }
        public void Details_RedirectsWhenIdDataIsIncorrect()
        {
            var result = _controller.Details(-1) as NotFoundResult;

            Assert.AreEqual(404, result.StatusCode);
        }