public async Task CreateUserAndDelete() { BesteUser besteUser = new BesteUser(); User user = new User { Username = "******", Lastname = "Lastname", Firstname = "Firstname", Email = "Email", Password = "******" }; ModifyUserResponse response = await besteUser.CreateUser(JsonConvert.SerializeObject(user, Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); ValiateResponse(response, ModifyUserResult.SUCCESS); User loginUser = new User { Username = user.Username, Password = user.Password }; response = await besteUser.DeleteUser(JsonConvert.SerializeObject(loginUser, Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); ValiateResponse(response, ModifyUserResult.SUCCESS); }
public async Task UnknownUser() { BesteUser besteUser = new BesteUser(); User user = new User { Username = "******", Password = "******" }; BesteUserAuthentificationResponse authResponse = await besteUser.Authenticate(JsonConvert.SerializeObject(user, Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); ValiateResponse(authResponse, BesteUserAuthentificationResult.USER_UNKNOWN); ModifyUserResponse response = await besteUser.EditUser(JsonConvert.SerializeObject(user, Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); ValiateResponse(response, ModifyUserResult.USER_UNKNOWN); response = await besteUser.ChangePasswordByUser(JsonConvert.SerializeObject(user, Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); ValiateResponse(response, ModifyUserResult.USER_UNKNOWN); response = await besteUser.DeleteUser(JsonConvert.SerializeObject(user, Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); ValiateResponse(response, ModifyUserResult.USER_UNKNOWN); }
internal async static Task DeleteUser(WebSocketHandler webSocketHandler) { Command resonseCommand = await ModifyUser(async() => { return(await BesteUser.DeleteUser(webSocketHandler.ReceivedCommand.CommandData.ToString())); }, "DeleteUser", webSocketHandler); await webSocketHandler.Send(resonseCommand); }
public async Task ForcedJsonSerializationErrors() { BesteUser besteUser = new BesteUser(); ModifyUserResponse response = await besteUser.CreateUser("no json]"); ValiateResponse(response, ModifyUserResult.JSON_ERROR); response = await besteUser.ChangePasswordByUser("no json]"); ValiateResponse(response, ModifyUserResult.JSON_ERROR); response = await besteUser.DeleteUser("no json]"); ValiateResponse(response, ModifyUserResult.JSON_ERROR); response = await besteUser.EditUser("no json]"); ValiateResponse(response, ModifyUserResult.JSON_ERROR); BesteUserAuthentificationResponse authResponse = await besteUser.Authenticate("no json]"); ValiateResponse(authResponse, BesteUserAuthentificationResult.JSON_ERROR); }