public void GetTokenExpirationDate() { NancyWebAppConfig.IdentityServerEnabled = true; var server = new TestServer(new WebHostBuilder().UseStartup(typeof(Startup))); var handler = server.CreateHandler(); var client = new BasicClient(handler, "https://server/connect/token", "client", "secret"); DateTimeOffset expirationDate; this.Invoking((a) => { // act client.AuthenticateUserAsync("alfredorevilla", "password", "api1").RunAsSynchronous(); expirationDate = client.GetTokenExpirationDate(); }) // assert .ShouldNotThrow(); expirationDate.Should().BeAfter(DateTimeOffset.UtcNow); expirationDate.Should().BeBefore(DateTimeOffset.MaxValue); }