public void GetAllChatRoomsCallChatRoomManager() { // Arrange var chatRoomManagerMock = new Mock <IChatRoomManager>(MockBehavior.Strict); chatRoomManagerMock.Setup(manager => manager.GetAllChatRooms()).Returns(new List <ChatRoom>()); ChatRoomController chatRoomController = new ChatRoomController(chatRoomManagerMock.Object); // Act var result = chatRoomController.GetAllChatRooms(); // Assert chatRoomManagerMock.Verify(manager => manager.GetAllChatRooms(), Times.Once); }
public void GetAllChatRoomsReturnsIEnumerableOfChatRoom() { // Arrange var chatRoomManagerMock = new Mock <IChatRoomManager>(MockBehavior.Strict); chatRoomManagerMock.Setup(manager => manager.GetAllChatRooms()).Returns(new List <ChatRoom>()); ChatRoomController chatRoomController = new ChatRoomController(chatRoomManagerMock.Object); // Act var result = chatRoomController.GetAllChatRooms(); // Assert Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(IEnumerable <ChatRoom>)); }