public void IndexCallsChatRoomBackendAgent() { // Arrange ChatRoomBackendServiceMock chatRoomService = new ChatRoomBackendServiceMock(); ChatRoomOverviewController controller = new ChatRoomOverviewController(chatRoomService); // Act var result = controller.Index(); // Assert Assert.AreEqual(chatRoomService.GetAllChatRoomsTimesCalled, 1); }
public void IndexReturnsViewResult() { // Arrange ChatRoomBackendServiceMock chatRoomService = new ChatRoomBackendServiceMock(); ChatRoomOverviewController controller = new ChatRoomOverviewController(chatRoomService); // Act var result = controller.Index(); // Assert Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(ViewResult)); }
public void IndexReturnsViewResultWithListOfChatRoomViewModel() { // Arrange ChatRoomBackendServiceMock chatRoomService = new ChatRoomBackendServiceMock(); ChatRoomOverviewController controller = new ChatRoomOverviewController(chatRoomService); // Act var result = controller.Index(); // Assert ViewResult viewResult = (ViewResult)result; var model = viewResult.Model; Assert.IsNotNull(model); Assert.IsInstanceOfType(viewResult.Model, typeof(IEnumerable <ChatRoomViewModel>)); }