private void PartialUpdateResponsesCleanUp() { var partialUpdateResponsesToDelete = scenarioContext.AllPartialUpdateResponses().ToList(); for (int i = 0; i < partialUpdateResponsesToDelete.Count; i++) { Log.Information("Attempting to delete partial update responses from scenario context"); scenarioContext.RemovePartialUpdateResponses(partialUpdateResponsesToDelete[i]); } }
public void ThenValidateTheIMSUserGetsResponsesWhileUpdatingEntity(string error, string message) { var getAllResponses = scenarioContext.AllPartialUpdateResponses().ToList(); for (int i = 0; i < getAllResponses.Count; i++) { getAllResponses[i].Response.StatusCode.ToString().Should().Be("207", $"user with {_testCfg.ImsScopes} scopes should not be able to update entities"); var response = getAllResponses[i].Response.Content.ReadAsStringAsync().GetAwaiter().GetResult(); JObject o = JObject.Parse(response); o.SelectToken("data.responses.failure").Should().NotBeEmpty(); var responseMessage = (string)(o.SelectToken("data.responses.failure").First["message"]); // Assert.AreEqual(message, responseMessage); Assert.IsTrue(responseMessage.Contains(message)); } }
public static void RemovePartialUpdateResponses(this ScenarioContext scenarioContext, RestClientResponse <PlatformItemResponse> response) { scenarioContext.AllPartialUpdateResponses().Remove(response); }