public async Task AddMessageAsyncTest() { var storeMock = new Mock <IChatStore <string, UserTest, Conversation, Attendee, Message, NotificationConnection> >(); var manager = new ChatManager <string, UserTest, Conversation, Attendee, Message, NotificationConnection>(storeMock.Object, new OptionsAccessor()); await manager.AddMessageAsync("test", "test", new Message() { Text = "Test" }); storeMock.Setup(s => s.FindUserByNameAsync("test", default(CancellationToken))).ReturnsAsync(new UserTest()); Assert.Null(await manager.AddMessageAsync("test", "test", new Message() { Text = "Test" })); storeMock.Setup(s => s.GetConversationAsync("test", default(CancellationToken))).ReturnsAsync(new Conversation()); Assert.NotNull(await manager.AddMessageAsync("test", "test", new Message() { Text = "Test" })); }
public async Task AddMessageAsync_should_throw_ArgumentNullException(string fromName, string conversationId) { var storeMock = new Mock <IChatStore <string, UserTest, Conversation, Attendee, Message, NotificationConnection> >(); var manager = new ChatManager <string, UserTest, Conversation, Attendee, Message, NotificationConnection>(storeMock.Object, new OptionsAccessor()); await Assert.ThrowsAsync <ArgumentNullException>(() => manager.AddMessageAsync(fromName, conversationId, null)); }