public async Task RetrieveToken_ExpiredAccessToken_ReturnsExpired() { var accessToken = "token1"; var cacheMock = new Mock <ITokenCache>(); var handler = TokenHandler.ExpiredToken(); Func <HttpClient> clientFactory = () => new HttpClient(handler) { BaseAddress = new Uri("http://dummy") }; var sut = new RestTokenProvider(clientFactory, cacheMock.Object); sut.Initialize(null, null, new Mock <ILogger>().Object); var tokenResult = await sut.RetrieveTokenAsync(accessToken); Assert.IsFalse(tokenResult.Success); Assert.IsTrue(tokenResult.Expired); }