Skip to content

Instantly share code, notes, and snippets.

@makomweb
Last active December 18, 2015 04:49
Show Gist options
  • Save makomweb/5728441 to your computer and use it in GitHub Desktop.
Save makomweb/5728441 to your computer and use it in GitHub Desktop.
Account confirmation for WL accounts.
[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