public async Task Can_add_sentence() { var user = TestExtensions.RandomUser(); var controller = new ChatController().WithUser(user); await Task.Delay(0); }
public async Task Can_add_channel() { ////Arrange var user = TestExtensions.RandomUser(); ////Act await new ChannelService().Create(user, "dimmer", false); ////Assert // .. no excetpison }
public async Task Can_join_channel() { ////Arrange var client = ElasticClientFactory.Create(); var user = TestExtensions.RandomUser(); await new UserService().EnsureUser(user); ////Act await new ChannelService().Join(user, "global"); ////Assert await client.Indices.RefreshAsync(Indices.Index <UserAccount>()); var userAccount = await new UserService().FindById(user.UserId()); Assert.IsTrue(userAccount.Channels.Contains("global")); }
public async Task Can_get_sentences() { var user = TestExtensions.RandomUser(); await new UserService().EnsureUser(user); var channelId = Guid.NewGuid().ToString("N"); var service = new ChatService(); await service.Add(user, new Sentence(channelId) { Text = "hello 1" }); await service.Add(user, new Sentence(channelId) { Text = "hello 2" }); await service.Add(user, new Sentence(channelId) { Text = "hello 3" }); await service.Add(user, new Sentence(channelId) { Text = "hello 4" }); var window = await service.GetUserUpdate(user, new Dictionary <string, string> { { channelId, null } }); Assert.AreEqual(window[channelId].Count, 4); }
public async Task Can_join_private_channel() { ////Arrange var client = ElasticClientFactory.Create(); var user1 = TestExtensions.RandomUser(); var user2 = TestExtensions.RandomUser(); await new UserService().EnsureUser(user1); await new UserService().EnsureUser(user2); ////Act var channel = await new ChannelService().Create(user1, "tester", false, new[] { user1.UserId(), user2.UserId() }); await new ChannelService().Join(user1, channel.Id); ////Assert await client.Indices.RefreshAsync(Indices.Index <UserAccount>()); var userAccount = await new UserService().FindById(user1.UserId()); Assert.IsTrue(userAccount.Channels.Contains(channel.Id)); }
public async Task Can_add_sentence() { var sentence = new Sentence(Guid.NewGuid().ToString()); await new ChatService().Add(TestExtensions.RandomUser(), sentence); }