public void BasicAuthorization_BothNull() { string testUsr = null; string testPwd = null; var restTest = new RESTClient <int, int>(); restTest.BasicAuthorization(testUsr, testPwd); Assert.IsFalse(restTest.headers.ContainsKey("Authorization")); }
public void BasicAuthorization_UsrIsNull() { string testUsr = null; const string testPwd = "password"; var cred = testUsr + ":" + testPwd; var restTest = new RESTClient <int, int>(); restTest.BasicAuthorization(testUsr, testPwd); Assert.IsFalse(restTest.headers.ContainsKey("Authorization")); }
public void BasicAuthorization_UsrPwd() { const string testUsr = "******"; const string testPwd = "password"; const string cred = testUsr + ":" + testPwd; var enc = Convert.ToBase64String(Encoding.UTF8.GetBytes(cred)); var expected = "Basic " + enc; var restTest = new RESTClient <int, int>(); restTest.BasicAuthorization(testUsr, testPwd); var actual = restTest.headers["Authorization"]; Assert.AreEqual(expected, actual); }