Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AppleTokenGenerator"/> class.
 /// </summary>
 /// <param name="authSetting">Your subscription identifier present in the membership section in your apple developer account</param>
 /// <param name="tokenGenerator">Generator of the jwt tokens</param>
 /// <param name="httpClient"></param>
 public AppleAuthClient(AppleAuthSetting authSetting, IAppleTokenGenerator tokenGenerator, HttpClient httpClient)
 {
     _authSetting    = Guard.Argument(authSetting, nameof(authSetting)).NotNull();
     _tokenGenerator = Guard.Argument(tokenGenerator, nameof(tokenGenerator)).NotNull().Value;
     _httpClient     = Guard.Argument(httpClient, nameof(httpClient)).NotNull();
     _httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/x-www-form-urlencoded"));
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AppleTokenGenerator"/> class.
 /// </summary>
 /// <param name="authSetting">Your subscription identifier present in the membership section in your apple developer account</param>
 /// <param name="tokenGenerator">Generator of the jwt tokens</param>
 public AppleAuthClient(AppleAuthSetting authSetting, IAppleTokenGenerator tokenGenerator) : this(authSetting, tokenGenerator, new HttpClient())
 {
 }
 public void AppleAuthClient_NotValidArgument_ThrowArgumentException(AppleAuthSetting authSetting, IAppleTokenGenerator privateKeySetting, HttpClient httpClient)
 {
     FluentActions.Invoking(() => new AppleAuthClient(authSetting, privateKeySetting, httpClient)).Should().Throw <ArgumentException>();
 }