dependabot[bot] on npm_and_yarn
Bump prismjs from 1.25.0 to 1.2… (compare)
jeremydmiller on gh-pages
Documentation Update for 6.1.0 (compare)
Hawxy on gh-pages
Documentation Update for 6.1.0 (compare)
github-actions[bot] on v6.1.0
Hawxy on master
Move to package license express… (compare)
dependabot[bot] on npm_and_yarn
Hawxy on master
Bump nanoid from 3.1.30 to 3.2.… (compare)
Hawxy on master
v6.1.0 (#103) * Minor code + d… (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
IScenarioAssertion
what I see as benefit as well is that on UT actions as here
[Test]
public async Task SearchOneFondsQueries()
{
await Run(
_ =>
{
var input = new GraphQLRequest
{
Query = @"{ funds(searchQuery: ""Fond de Test Hedge en Duration"") { name } }"
};
_.Post.Json(input).ToUrl("/graphql");
_.StatusCodeShouldBe(HttpStatusCode.OK);
_.GraphQL()
.ShouldBeSuccess(@"{ ""funds"": [
{
""name"": ""Fond de Test Hedge en Duration""
}]}");
});
}
where Scenario
is passed in into the Run
function, I could add extensions method that would allow for me to retrieve a dependency, and configure expectations on it. Because for my test some fake dependencies are registered in within the test startup and initialized with SystemUnderTest.ForStartup<T>(builder =>...
so that way I would have an easy way to retrieve them and set expectations based on test requirements