public void GetTokenUserId() { 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"); string userId = null; this.Invoking((a) => { // act client.AuthenticateUserAsync("alfredorevilla", "password", "api1").RunAsSynchronous(); userId = client.GetTokenUserId(); }) // assert .ShouldNotThrow(); userId.Should().Be("F7D5AC0B-5C00-4253-8B54-046392260658"); }