public void Setup() { var creds = new UserCredentials("foo", "auth", "http://foo.com"); _client = new FakeClient(); _conn = new CF_Connection(creds, _client); _conn.Authenticate(); }
public void TestAuthenticateFail() { var creds = new UserCredentials("foo", "fail", "http://foo.com"); Client client = new FakeClient(); Connection conn = new CF_Connection(creds, client); Assert.AreEqual(conn.UserCreds.UserName, "foo"); Assert.AreEqual(conn.UserCreds.AuthUrl, "http://foo.com/"); Assert.AreEqual(conn.UserCreds.ApiKey, "fail"); Assert.Throws<AuthenticationFailedException>(conn.Authenticate); }
public void TestAuthenticateFail() { var creds = new UserCredentials("foo", "fail", "http://foo.com"); Client client = new FakeClient(); Connection conn = new CF_Connection(creds, client); Assert.AreEqual(conn.UserCreds.UserName, "foo"); Assert.AreEqual(conn.UserCreds.AuthUrl, "http://foo.com/"); Assert.AreEqual(conn.UserCreds.ApiKey, "fail"); Assert.Throws <AuthenticationFailedException>(conn.Authenticate); }
public void TestAuthenticate() { var creds = new UserCredentials("foo", "auth", "http://foo.com"); Client client = new FakeClient(); Connection conn = new CF_Connection(creds, client); Assert.AreEqual(conn.UserCreds.UserName, "foo"); Assert.AreEqual(conn.UserCreds.AuthUrl, "http://foo.com"); Assert.AreEqual(conn.UserCreds.ApiKey, "auth"); conn.Authenticate(); Assert.AreEqual(conn.UserCreds.CdnMangementUrl.ToString(), "https://foo.com/"); Assert.AreEqual(conn.UserCreds.StorageUrl.ToString(), "https://foo.com/"); Assert.AreEqual(conn.UserCreds.AuthToken, "foo"); }
public void TestConnectionCheckMembers() { var creds = new UserCredentials("foo", "auth", "http://foo.com"); Client client = new FakeClient(); Connection conn = new CF_Connection(creds, client); Assert.AreEqual(conn.UserCreds.UserName, "foo"); Assert.AreEqual(conn.UserCreds.AuthUrl, "http://foo.com/"); Assert.AreEqual(conn.UserCreds.ApiKey, "auth"); conn.Authenticate(); Assert.AreEqual(conn.UserCreds.CdnMangementUrl.ToString(), "https://foo.com/"); Assert.AreEqual(conn.UserCreds.StorageUrl.ToString(), "https://foo.com/"); Assert.AreEqual(conn.UserCreds.AuthToken, "foo"); Assert.True(conn.HasCDN); conn.UserCreds.CdnMangementUrl = null; Assert.IsFalse(conn.HasCDN); conn.UserAgent = "foo"; Assert.AreEqual(conn.UserAgent, "foo"); conn.Timeout = 1; Assert.AreEqual(conn.Timeout, 1); conn.Retries = 1; Assert.AreEqual(conn.Retries, 1); }