Last active
December 18, 2015 04:49
-
-
Save makomweb/5728441 to your computer and use it in GitHub Desktop.
Account confirmation for WL accounts.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestFixture] | |
public class ConfirmAccount | |
{ | |
private const string _server = "http://www.example.com" | |
private const string _email = "foo@bar.com"; | |
private const string _password = "12345"; | |
private Client _client; | |
[SetUp] | |
public void SetUp() | |
{ | |
_client = new Client(_server, new CustomHttpClient()); | |
_client.Login(_email, _password); | |
} | |
[TearDown] | |
public void TearDown() | |
{ | |
if (_client != null) | |
_client.Dispose(); | |
_client = null; | |
} | |
[Test] | |
public void Confirm_account() | |
{ | |
const string userId = "<THE-USER-ID>"; | |
const string session = "<THE-SESSION-TOKEN>"; | |
_client.ConfirmRegistration(userId, session); | |
} | |
} | |
public class Client | |
{ | |
// ... omitted other functions! | |
public void ConfirmRegistration(string userId, string signature) | |
{ | |
var dict = new Dictionary<string, string> | |
{ | |
{"user_id", userId}, | |
{"signature", signature} | |
}; | |
var uri = string.Format("{0}/{1}", Server, "confirm"); | |
var content = JsonConvert<Dictionary<string, string>>.Create(dict); | |
var resp = _http.Put(uri, content); | |
ValidateResponse(resp); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment