public async Task TestIfConnectionAlreadyEstablishedReturnsTrue(string connectionId, string subject, string email, string technicianName) { var context = PCHUBDbContextInMemoryInitializer.InitializeContext(); var chatRequests = new RequestChatServices(context); await chatRequests.EstablishConnectionAsync(connectionId, subject, email, technicianName); Assert.True(await chatRequests.ConnectionAlreadyEstablishedAsync(connectionId, "StoreUser")); }
public async Task TestIfEstablishedConnectionDetailsWorksAccordingly(string connectionId, string subject, string email, string technicianName) { var context = PCHUBDbContextInMemoryInitializer.InitializeContext(); var chatRequests = new RequestChatServices(context); await chatRequests.EstablishConnectionAsync(connectionId, subject, email, technicianName); Assert.NotNull(await chatRequests.EstablishedConnectionDetailsAsync(connectionId, "StoreUser")); Assert.NotNull(await chatRequests.EstablishedConnectionDetailsAsync(technicianName, "Admin")); }
public async Task TestIfDisconnectFromChatWorksAccordingly(string connectionId, string subject, string email, string technicianName) { var context = PCHUBDbContextInMemoryInitializer.InitializeContext(); var chatRequests = new RequestChatServices(context); await chatRequests.EstablishConnectionAsync(connectionId, subject, email, technicianName); await chatRequests.DisconnectFromChat(technicianName, connectionId); var chat = await context.Chats.FirstOrDefaultAsync(x => x.TechnicianName == technicianName && x.ConnectionId == connectionId && x.ConnectionTerminated == true); Assert.NotNull(chat); Assert.True(chat.ConnectionTerminated); }
public async Task TestIfEstablishConnectionWorksAccordingly(string connectionId, string subject, string email, string technicianName) { var context = PCHUBDbContextInMemoryInitializer.InitializeContext(); var chatRequests = new RequestChatServices(context); await chatRequests.EstablishConnectionAsync(connectionId, subject, email, technicianName); var result = await context.Chats.FirstOrDefaultAsync(x => x.ConnectionId == connectionId); Assert.NotNull(result); Assert.Equal(subject, result.Subject); Assert.Equal(technicianName, result.TechnicianName); }
public async Task TestIfInsertChatWorksAccordingly(string connectionId, string subject, string email, string technicianName) { var context = PCHUBDbContextInMemoryInitializer.InitializeContext(); var chatRequests = new RequestChatServices(context); await chatRequests.EstablishConnectionAsync(connectionId, subject, email, technicianName); await chatRequests.InsertChatAsync(technicianName, connectionId, "User", "Please help me make the best choice!"); var result = await context.Chats.FirstOrDefaultAsync(x => x.ConnectionId == connectionId); Assert.NotNull(result); Assert.NotNull(result.Messages); }