public async void Join([FromBody] User userJoining, [FromQuery] string socketId) { Console.WriteLine("UserController : Join"); if (userJoining.userId == Guid.Empty) { userJoining.userId = Guid.NewGuid(); } var mess = _notificationsMessageHandler.GenerateMessageFromPayload(userJoining, MessageType.JoinRequested); await _notificationsMessageHandler.SendMessageAsync(socketId, mess); _userHandler.Add(userJoining, socketId); mess = _notificationsMessageHandler.GenerateMessageFromPayload(_chatHandler.GetCacheMessages(), MessageType.MessageHistory); await _notificationsMessageHandler.SendMessageAsync(socketId, mess); mess = _notificationsMessageHandler.GenerateMessageFromPayload(_userHandler.GetUsers(), MessageType.UsersRequested); await _notificationsMessageHandler.SendMessageAsync(socketId, mess); mess = _notificationsMessageHandler.GenerateMessageFromPayload(userJoining, MessageType.UserJoined); await _notificationsMessageHandler.SendMessageToAllAsync(mess); }
public void TestDeleteClient() { Client client = new Client(USERNAME_OK, PASSWORD_OK, NAME_OK, SURNAME_OK, CI_OK, PHONE_OK, ADDRESS_OK, REGISTRATIONDATE_OK, null); CLIENT_HANDLER.Add(client); CLIENT_HANDLER.Delete(client); Assert.IsFalse(CLIENT_HANDLER.boolExist(client)); }