Example #1
0
        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);
        }
Example #2
0
        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>));
        }