dependabot[bot] on npm_and_yarn
Bump shell-quote from 1.7.2 to … (compare)
dependabot[bot] on nuget
Bump Newtonsoft.Json from 9.0.1… (compare)
public async Task Test_Logging()
{
var builder = BusinessRulesEngine.Web.Program.CreateWebHostBuilder(new string[] { });
using (var system = new SystemUnderTest(builder, typeof(Startup).Assembly))
{
await system.Scenario(_ =>
{
_.Get.Url("/home/TestLogging");
_.ContentShouldBe("");
_.StatusCodeShouldBeOk();
});
}
}
I have this code to assert on GraphQL queries
public class SuccessResultAssertion : GraphQLAssertion
{
private readonly string _result;
public SuccessResultAssertion(string result) => _result = result;
public override void Assert(Scenario scenario, HttpContext context, ScenarioAssertionException ex)
{
var writer = (IDocumentWriter) context.RequestServices.GetService(typeof(IDocumentWriter));
var expectedResult = writer.Write(CreateQueryResult(_result));
var body = ex.ReadBody(context);
if (!body.Equals(expectedResult))
{
ex.Add($"Expected '{expectedResult}' but got '{body}'");
}
}
}
So I noticed that while executing tests only the first test has context.RequestServices
filled, the scond tests throws an exception as RequestServices
is null