Пример #1
0
        public void ViewTest_InvalidRoom_Returns404()
        {
            var mockDal    = new Mock <IRoomDAL>();
            var controller = new RoomsController(mockDal.Object, null);

            var result = controller.View(1) as HttpNotFoundResult;

            Assert.IsNotNull(result);
        }
Пример #2
0
        public void ViewTest_ValidRoom_ReturnsViewAction()
        {
            var mockRoomDal    = new Mock <IRoomDAL>();
            var mockMessageDal = new Mock <IMessageDAL>();

            mockRoomDal.Setup(m => m.GetChatRoom(1)).Returns(new RoomModel()
            {
                Id = 1
            });
            var controller = new RoomsController(mockRoomDal.Object, mockMessageDal.Object);

            var result = controller.View(1) as ViewResult;

            Assert.IsNotNull(result);
            Assert.AreEqual("View", result.ViewName);
            Assert.IsNotNull(result.Model as RoomViewModel);
        }