public MockAccountsService() { var token = new BearerAccessToken { AccessToken = "abcd1234", ExpiresIn = 3600 }; token.SetExpires(DateTime.UtcNow); Setup(s => s.GetAppAccessToken()).ReturnsAsync(token); }
public void SetExpires_ExpiresIn3600_ExpiryIs1HourGreaterThanNow() { // arrange var token = new BearerAccessToken { ExpiresIn = 3600 }; var now = DateTime.UtcNow; // act token.SetExpires(now); // assert Assert.AreEqual(now.AddSeconds(3600), token.Expires.Value); }
public void SetExpires_NowIsUtcDate_ReturnsUtcDate() { // arrange var token = new BearerAccessToken { ExpiresIn = 3600 }; var now = DateTime.UtcNow; // act token.SetExpires(now); // assert Assert.AreEqual(token.Expires.Value.Kind, DateTimeKind.Utc); }