예제 #1
0
        public void GetAllChatRoomsCallsRepository()
        {
            // Arrange
            var chatRoomRepositoryMock = new Mock <IRepository <ChatRoom, long> >(MockBehavior.Strict);

            chatRoomRepositoryMock.Setup(repository => repository.FindAll()).Returns(new List <ChatRoom>());
            ChatRoomManager chatRoomManager = new ChatRoomManager(chatRoomRepositoryMock.Object);

            // Act
            var result = chatRoomManager.GetAllChatRooms();

            // Assert
            chatRoomRepositoryMock.Verify(repository => repository.FindAll(), Times.Once);
        }
예제 #2
0
        public void GetAllChatRoomsReturnsIEnumerableChatRoom()
        {
            // Arrange
            var chatRoomRepositoryMock = new Mock <IRepository <ChatRoom, long> >(MockBehavior.Strict);

            chatRoomRepositoryMock.Setup(repository => repository.FindAll()).Returns(new List <ChatRoom>());
            ChatRoomManager chatRoomManager = new ChatRoomManager(chatRoomRepositoryMock.Object);

            // Act
            var result = chatRoomManager.GetAllChatRooms();

            // Assert
            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(IEnumerable <ChatRoom>));
        }