public DummyHttpWebRequest(DummyNetUtility net, string url)
 {
     _stream    = new MemoryStream();
     _net       = net;
     Headers    = new WebHeaderCollection();
     RequestUri = new Uri(url);
 }
        public async Task TestGetTokenInfoAsync_ByRefreshToken_Passed()
        {
            var    credential   = new TestCredential();
            string refreshToken = "refreshToken";

            var net      = new DummyNetUtility();
            var response = new DummyHttpWebResponse(HttpStatusCode.OK, @"{
""access_token"": ""accessToken"",
""expires_in"": 123
}");

            net.AddResponse(response);
            var      oauth2     = new OAuth2Utility(net);
            DateTime timeBefore = DateTime.UtcNow;
            var      tokenInfo  = await oauth2.GetTokenInfoAsync(credential, refreshToken);

            DateTime timeAfter = DateTime.UtcNow;

            Assert.Equal("accessToken", tokenInfo.AccessToken);
            Assert.Equal(123, tokenInfo.ExpiresIn);
            Assert.True(timeBefore <= tokenInfo.IssuedTime && tokenInfo.IssuedTime <= timeAfter, $"Expect {timeBefore} <= Issued Time {tokenInfo.IssuedTime} <= {timeAfter}");
        }