public MockAccountsService()
        {
            var token = new BearerAccessToken {
                AccessToken = "abcd1234", ExpiresIn = 3600
            };

            token.SetExpires(DateTime.UtcNow);
            Setup(s => s.GetAppAccessToken()).ReturnsAsync(token);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }