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); }
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>)); }