private BitbucketOAuth2Client GetBitbucketOAuth2Client() { var client = new BitbucketOAuth2Client(httpClient.Object, settings.Object); client.CodeGenerator = codeGenerator.Object; return(client); }
public async Task BitbucketOAuth2Client_GetAuthorizationCodeAsync_RespectsClientIdOverride_ReturnsCode(string clientId) { MockClientIdOverride(clientId != null, clientId); Uri finalCallbackUri = MockFinalCallbackUri(); MockGetAuthenticationCodeAsync(finalCallbackUri, clientId); MockCodeGenerator(); BitbucketOAuth2Client client = GetBitbucketOAuth2Client(); var result = await client.GetAuthorizationCodeAsync(scopes, browser.Object, ct); VerifyAuthorizationCodeResult(result); }
public async Task BitbucketOAuth2Client_GetAuthorizationCodeAsync_ReturnsCode() { MockClientIdOverride(false, "never used"); Uri finalCallbackUri = MockFinalCallbackUri(); MockGetAuthenticationCodeAsync(finalCallbackUri, null); MockCodeGenerator(); BitbucketOAuth2Client client = GetBitbucketOAuth2Client(); var result = await client.GetAuthorizationCodeAsync(scopes, browser.Object, ct); VerifyAuthorizationCodeResult(result); }
public async Task BitbucketOAuth2Client_GetDeviceCodeAsync() { var client = new BitbucketOAuth2Client(httpClient.Object, settings.Object); await Assert.ThrowsAsync <InvalidOperationException>(async() => await client.GetDeviceCodeAsync(scopes, ct)); }