public void VstsAadNoninteractiveLogonWithCredentialsTest() { TargetUri targetUri = DefaultTargetUri; VstsAadAuthentication aadAuthentication = GetVstsAadAuthentication("aad-noninter-creds"); Credential originCreds = DefaultCredentials; Credential personalAccessToken; Token azureToken; Assert.IsTrue(Task.Run(async() => { return(await aadAuthentication.NoninteractiveLogonWithCredentials(targetUri, originCreds, false)); }).Result, "Non-interactive logon unexpectedly failed."); Assert.IsTrue(aadAuthentication.PersonalAccessTokenStore.ReadCredentials(targetUri, out personalAccessToken), "Personal Access Token not found in store as expected."); Assert.IsTrue(aadAuthentication.AdaRefreshTokenStore.ReadToken(targetUri, out azureToken) && azureToken.Value == "token-refresh", "ADA Refresh Token not found in store as expected."); Assert.IsFalse(String.Equals(originCreds.Password, personalAccessToken.Password, StringComparison.OrdinalIgnoreCase) || String.Equals(originCreds.Username, personalAccessToken.Password, StringComparison.OrdinalIgnoreCase), "Supplied credentials and Personal Access Token values unexpectedly matched."); }