public async Task CreateUserAndChangePasswortBreakRules()
        {
            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 = "******"
            };

            response = await besteUser.ChangePasswordByUser(JsonConvert.SerializeObject(loginUser, Formatting.None, new JsonSerializerSettings {
                NullValueHandling = NullValueHandling.Ignore
            }));

            ValiateResponse(response, ModifyUserResult.PASSWORD_GUIDELINES_ERROR);
        }
        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 ChangePassword(WebSocketHandler webSocketHandler)
        {
            Command resonseCommand = await ModifyUser(async() => {
                return(await BesteUser.ChangePasswordByUser(webSocketHandler.ReceivedCommand.CommandData.ToString()));
            },
                                                      "ChangePassword",
                                                      webSocketHandler);

            await webSocketHandler.Send(resonseCommand);
        }
        public async Task CreateUserAndLogin()
        {
            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
            };
            BesteUserAuthentificationResponse authResponse = await besteUser.Authenticate(JsonConvert.SerializeObject(loginUser, Formatting.None, new JsonSerializerSettings {
                NullValueHandling = NullValueHandling.Ignore
            }));

            ValiateResponse(authResponse, BesteUserAuthentificationResult.MUST_CHANGE_PASSWORT);

            response = await besteUser.ChangePasswordByUser(JsonConvert.SerializeObject(loginUser, Formatting.None, new JsonSerializerSettings {
                NullValueHandling = NullValueHandling.Ignore
            }));

            ValiateResponse(response, ModifyUserResult.SUCCESS);

            authResponse = await besteUser.Authenticate(JsonConvert.SerializeObject(loginUser, Formatting.None, new JsonSerializerSettings {
                NullValueHandling = NullValueHandling.Ignore
            }));

            ValiateResponse(authResponse, BesteUserAuthentificationResult.SUCCESS);
        }
        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);
        }