diff --git a/Src/Support/Google.Apis.Auth.Tests/Google.Apis.Auth.Tests.csproj b/Src/Support/Google.Apis.Auth.Tests/Google.Apis.Auth.Tests.csproj
index d664d42626..aea9f05d34 100644
--- a/Src/Support/Google.Apis.Auth.Tests/Google.Apis.Auth.Tests.csproj
+++ b/Src/Support/Google.Apis.Auth.Tests/Google.Apis.Auth.Tests.csproj
@@ -1,35 +1,50 @@
-
- netcoreapp1.0;net452;net46
+ netcoreapp1.0;net452;net46;uap10.0
netcoreapp1.0
true
true
..\..\..\google.apis.snk
false
+ pdbonly
+ true
-
-
-
-
-
+
+ .NETStandard
+ v1.4
+ UAP,Version=v10.0
+ UAP
+ 10.0.14393.0
+ 10.0.10240.0
+ UAP,Version=v10.0
+ $(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets
+ $(DefineConstants);UAP10_0
+ en-US
+
+
+
+
+
-
-
+
+
+
+
+
\ No newline at end of file
diff --git a/Src/Support/Google.Apis.Auth.Tests/GoogleJsonWebSignatureTests.cs b/Src/Support/Google.Apis.Auth.Tests/GoogleJsonWebSignatureTests.cs
index 63e1d93416..9fd79c4965 100644
--- a/Src/Support/Google.Apis.Auth.Tests/GoogleJsonWebSignatureTests.cs
+++ b/Src/Support/Google.Apis.Auth.Tests/GoogleJsonWebSignatureTests.cs
@@ -158,7 +158,6 @@ public async Task Invalid_Aud()
[Fact]
public async Task Validate_Signature_Time()
{
-
var clockInvalid1 = new MockClock() { UtcNow = new DateTime(2017, 5, 31, 10, 22, 0, DateTimeKind.Utc) };
var clockValid1 = new MockClock() { UtcNow = new DateTime(2017, 5, 31, 10, 24, 0, DateTimeKind.Utc) };
var clockValid2 = new MockClock() { UtcNow = new DateTime(2017, 5, 31, 11, 22, 0, DateTimeKind.Utc) };
@@ -188,14 +187,17 @@ public async Task Invalid_HostedDomain()
[Fact]
public async Task Validate_CertCache()
{
+ // Reset GoogleJsonWebSignature before starting this test
+ GoogleJsonWebSignature._certCacheDownloadTime = new DateTime(2000, 1, 1, 0, 0, 0, DateTimeKind.Utc);
+
var clock1 = new MockClock() { UtcNow = new DateTime(2017, 5, 31, 11, 24, 0, DateTimeKind.Utc) };
var clock2Cached = new MockClock() { UtcNow = clock1.UtcNow + GoogleJsonWebSignature.CertCacheRefreshInterval - TimeSpan.FromSeconds(1) };
var clock3Uncached = new MockClock() { UtcNow = clock1.UtcNow + GoogleJsonWebSignature.CertCacheRefreshInterval + TimeSpan.FromSeconds(1) };
- var rsas1 = await GoogleJsonWebSignature.GetGoogleCertsAsync(clock1, false, GoogleCertsJson);
- var rsas2Cached = await GoogleJsonWebSignature.GetGoogleCertsAsync(clock2Cached, false, GoogleCertsJson);
- var rsas3Refreshed = await GoogleJsonWebSignature.GetGoogleCertsAsync(clock3Uncached, false, GoogleCertsJson);
- var rsas4Forced = await GoogleJsonWebSignature.GetGoogleCertsAsync(clock3Uncached, true, GoogleCertsJson);
+ var rsas1 = await GoogleJsonWebSignature.GetGoogleCertsAsync(clock1, false, GoogleCertsJson).ConfigureAwait(false);
+ var rsas2Cached = await GoogleJsonWebSignature.GetGoogleCertsAsync(clock2Cached, false, GoogleCertsJson).ConfigureAwait(false);
+ var rsas3Refreshed = await GoogleJsonWebSignature.GetGoogleCertsAsync(clock3Uncached, false, GoogleCertsJson).ConfigureAwait(false);
+ var rsas4Forced = await GoogleJsonWebSignature.GetGoogleCertsAsync(clock3Uncached, true, GoogleCertsJson).ConfigureAwait(false);
Assert.NotNull(rsas1);
Assert.Same(rsas1, rsas2Cached);
diff --git a/Src/Support/Google.Apis.Auth.Tests/OAuth2/Flows/AuthorizationCodeFlowTests.cs b/Src/Support/Google.Apis.Auth.Tests/OAuth2/Flows/AuthorizationCodeFlowTests.cs
index ae0593059d..2f84fa7abf 100644
--- a/Src/Support/Google.Apis.Auth.Tests/OAuth2/Flows/AuthorizationCodeFlowTests.cs
+++ b/Src/Support/Google.Apis.Auth.Tests/OAuth2/Flows/AuthorizationCodeFlowTests.cs
@@ -23,7 +23,6 @@ limitations under the License.
using Google.Apis.Tests.Mocks;
using Google.Apis.Util;
using Google.Apis.Util.Store;
-using Moq;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -98,9 +97,7 @@ public void LoadTokenAsync_NoDataStore()
[Fact]
public void LoadTokenAsync_NullResponse()
{
- TaskCompletionSource tcs = new TaskCompletionSource();
- tcs.SetResult(null);
- Assert.Null(SubtestLoadTokenAsync(tcs));
+ Assert.Null(SubtestLoadTokenAsync(null));
}
[Fact]
@@ -110,21 +107,18 @@ public void LoadTokenAsync_TokenResponse()
{
AccessToken = "access"
};
-
- TaskCompletionSource tcs = new TaskCompletionSource();
- tcs.SetResult(response);
- var result = SubtestLoadTokenAsync(tcs);
+ var result = SubtestLoadTokenAsync(response);
Assert.Equal(response, result);
}
- private TokenResponse SubtestLoadTokenAsync(TaskCompletionSource tcs)
+ private TokenResponse SubtestLoadTokenAsync(TokenResponse response)
{
- var mock = new Mock();
- mock.Setup(ds => ds.GetAsync("user")).Returns(tcs.Task);
- var flow = CreateFlow(dataStore: mock.Object);
- var result = flow.LoadTokenAsync("user", CancellationToken.None).Result;
- mock.Verify(ds => ds.GetAsync("user"));
- return result;
+ var datastore = new MemoryDataStore();
+ var flow0 = CreateFlow(dataStore: datastore);
+ Assert.Null(flow0.LoadTokenAsync("user", CancellationToken.None).Result);
+ datastore.StoreAsync("user", response).Wait();
+ var flow1 = CreateFlow(dataStore: datastore);
+ return flow1.LoadTokenAsync("user", CancellationToken.None).Result;
}
#endregion
@@ -148,7 +142,7 @@ public void TestCreateAuthorizationCodeRequest()
[Fact]
public void TestExchangeCodeForTokenAsync()
{
- var mock = new Mock();
+ var datastore = new MemoryDataStore();
var handler = new FetchTokenMessageHandler();
handler.AuthorizationCodeTokenRequest = new AuthorizationCodeTokenRequest()
{
@@ -158,21 +152,18 @@ public void TestExchangeCodeForTokenAsync()
};
MockHttpClientFactory mockFactory = new MockHttpClientFactory(handler);
- TaskCompletionSource