예제 #1
0
        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);
        }
예제 #2
0
        internal async static Task EditUser(WebSocketHandler webSocketHandler)
        {
            Command resonseCommand = await ModifyUser(async() =>
            {
                return(await BesteUser.EditUser(webSocketHandler.ReceivedCommand.CommandData.ToString()));
            },
                                                      "EditUser",
                                                      webSocketHandler);

            await webSocketHandler.Send(resonseCommand);
        }
예제 #3
0
        public async Task CreateUserAndEdit()
        {
            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           = "******",
                Lastname           = "Lastname",
                Firstname          = "Firstname",
                Email              = "Email",
                Password           = "******",
                MustChangePassword = false
            };

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

            ValiateResponse(response, ModifyUserResult.SUCCESS);

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

            ValiateResponse(authResponse, BesteUserAuthentificationResult.SUCCESS);
        }
예제 #4
0
        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);
        }