public void UpdateUserShouldSucceed()
        {
            string expectedRequestUrl = ClientModuleFunctionalTestingUtilities.SANDBOX_URL_PREFIX + "/v14/users/123";

            IModifyUser client = ClientModuleFunctionalTestingUtilities.GetMockedLevelUpModule <IModifyUser>(
                expectedCreateOrUpdateUserResponse, expectedRequestUrl: expectedRequestUrl);
            var user = client.UpdateUser("not_checking_this", new UpdateUserRequestBody(123));

            Assert.AreEqual(user.GlobalCreditAmount, globalCreditAmount);
            Assert.AreEqual(user.Gender, gender);
            Assert.AreEqual(user.CustomAttributes[customAttributes.Key], customAttributes.Value);
        }
        public void PasswordResetRequestShouldSucceed()
        {
            const string expectedRequestUrl  = ClientModuleFunctionalTestingUtilities.SANDBOX_URL_PREFIX + "/v14/passwords";
            const string expectedRequestBody = "{\"email\": \"[email protected]\"}";

            RestResponse expectedResponse = new RestResponse
            {
                StatusCode = HttpStatusCode.NoContent
            };

            IModifyUser client = ClientModuleFunctionalTestingUtilities.GetMockedLevelUpModule <IModifyUser, PasswordResetRequest>(
                expectedResponse, expectedRequestBody, expectedRequestUrl);

            client.PasswordResetRequest("*****@*****.**");
        }
        public void PasswordResetRequestShouldSucceed()
        {
            const string expectedRequestUrl  = "https://sandbox.thelevelup.com/v14/passwords";
            const string expectedRequestBody = "{\"email\": \"[email protected]\"}";

            RestResponse expectedResponse = new RestResponse
            {
                StatusCode = HttpStatusCode.NoContent
            };

            IModifyUser client = ClientModuleUnitTestingUtilities.GetMockedLevelUpModule <IModifyUser, PasswordResetRequest>(
                expectedResponse, expectedRequestBody, expectedRequestUrl);

            client.PasswordResetRequest("*****@*****.**");
        }
        public void CreateUserShouldSucceed()
        {
            string expectedRequestUrl = ClientModuleFunctionalTestingUtilities.SANDBOX_URL_PREFIX + "/v14/users";

            string expectedRequestBody = string.Format("{{" +
                                                       "\"api_key\": \"{0}\"," +
                                                       "\"user\":{{" +
                                                       "\"email\":\"{1}\"," +
                                                       "\"first_name\":\"{2}\"," +
                                                       "\"last_name\":\"{3}\"," +
                                                       "\"password\":\"{4}\"" +
                                                       "}}," +
                                                       "}}", apiKey, email, firstName, lastName, password);

            IModifyUser client = ClientModuleFunctionalTestingUtilities.GetMockedLevelUpModule <IModifyUser, CreateUserRequest>(
                expectedCreateOrUpdateUserResponse, expectedRequestBody, expectedRequestUrl: expectedRequestUrl);
            var user = client.CreateUser(apiKey, firstName, lastName, email, password);

            Assert.AreEqual(user.GlobalCreditAmount, globalCreditAmount);
            Assert.AreEqual(user.Gender, gender);
            Assert.AreEqual(user.CustomAttributes[customAttributes.Key], customAttributes.Value);
        }