public async Task CanGetEmptyStatusListAsync() { server.Reset(); var expected = new List <DurableFunctionStatus>(); server .Given( Request .Create() .WithPath("/runtime/webhooks/durabletask/instances") .UsingGet() ) .RespondWith( Response .Create() .WithStatusCode(200) .WithBody("[]") ); var client = new DurableFunctionClient(server.Ports[0]); var actual = await client.GetAllFunctionStatuses(); actual.Should().BeEquivalentTo(expected); }
public async Task ValidateShouldReturnTrueOnValidTIHJwt() { var validToken = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOiIxNTk5NzUzMTk5IiwiYWNjZXNzX3Rva2VuIjoidGVzdF9hY2Nlc3NfdG9rZW4iLCJpZCI6IjAifQ.osL8kyPx90gUapZzz6Iv-H8DPwgtJTMSKTJA1VtMirU"; var validExp = _DateTimeProvider.Now().AddHours(_ClaimLifetimeHours - .1).ToUnixTimeU64(); var testClaims = new Dictionary <string, string> { { "id", "0" }, { "exp", validExp.ToString() }, { "access_token", validToken } }; _Server.Reset(); _Server.Given( Request.Create() .WithHeader("Authorization", "Bearer " + validToken) .WithPath("/ggdghornl_test/oauth2/v1/verify").UsingGet() ) .RespondWith( Response.Create() .WithStatusCode(200) .WithHeader("Content-Type", "application/json") .WithBody("{\"audience\":1234}") ); Assert.True(await _JwtClaimValidator.ValidateAsync(testClaims)); }
public async Task Get_DeveRetornarCache_QuandoDisponivel() { //Arrange IEnumerable <FilmeModel> cache; A.CallTo(() => _apiFixture.MemoryCacheWrapperFake .TryGetValue(_systemSettings.FilmesCacheKey, out cache)) .CallsBaseMethod(); var chaveCampeonato = ChaveClassificacaoBuilder.Novo().ComParticipantesFixos().Build(); var participantes = chaveCampeonato.ObterParticipantes(); _wireMockServer .Given(_request) .RespondWith(Response.Create().WithSuccess().WithBodyAsJson(participantes)); //Act await _httpClient.GetAsync(_endpoint); _wireMockServer.Reset(); _wireMockServer .Given(_request) .RespondWith(Response.Create().WithNotFound()); var responseApiCache = await _httpClient.GetAsync(_endpoint); //Assert responseApiCache.Should().Be200Ok().And.BeAs(participantes); }
public void ReturnsImmediatelyForFinishedTask(string status) { server.Reset(); server .Given( Request .Create() .WithPath("/runtime/webhooks/durabletask/instances") .UsingGet() ) .RespondWith( Response .Create() .WithStatusCode(200) .WithBody(@"[ { ""name"": ""MyDurableOrchestrator"", ""instanceId"": ""93581509a6898c110182fedbeef29616"", ""runtimeStatus"": """ + status + @""", ""input"": [], ""customStatus"": null, ""output"": null, ""createdTime"": ""2020-11-03T21:44:45Z"", ""lastUpdatedTime"": ""2020-11-03T21:44:46Z"" } ]") ); var client = new DurableFunctionClient(server.Ports[0]); Func <Task> waiting = () => Awaiter.WaitForInstance(client, "93581509a6898c110182fedbeef29616"); waiting.Should().CompleteWithin(1000.Milliseconds()); }
public void VerifyTokenShouldReturnTrueOnValidToken() { var validToken = "valid_access_token"; _Server.Reset(); _Server.Given( Request.Create() .WithHeader("Authorization", "Bearer " + validToken) .WithPath("/ggdghornl_test/oauth2/v1/verify").UsingGet() ) .RespondWith( Response.Create() .WithStatusCode(200) .WithHeader("Content-Type", "application/json") .WithBody("{\"audience\":1234}") ); Assert.IsTrue(_TheIdentityHubService.VerifyToken(validToken).Result); }
public void Dispose() { Server.Reset(); }
public void ResetServer() { MockServer.Reset(); }
private static void BeforeScenario(ScenarioContext currentScenario) { Console.WriteLine($"Starting Scenario: {currentScenario.ScenarioInfo.Title}"); TwitterLoginStub.Reset(); TwitterStub.Reset(); }