public void Create(string userName, string expectedDomain, string expectedUserName) { NetworkCredentialUserName networkCredentialUserName = new NetworkCredentialUserName(userName); Assert.AreEqual(expectedDomain, networkCredentialUserName.Domain); Assert.AreEqual(expectedUserName, networkCredentialUserName.UserName); }
private static void SetCredentials(DownloadFileInfo file, WebRequest webRequest) { if (file.Authenticate) { NetworkCredentialUserName networkCredentialUserName = new NetworkCredentialUserName(file.UserName); webRequest.Credentials = new NetworkCredential(networkCredentialUserName.UserName, file.Password, networkCredentialUserName.Domain); } }