public async Task Should_only_use_rules_from_Default_ruleset() { var msg = await _webApp.RunRulesetAction("/ClientSide/DefaultRuleset"); msg.Length.ShouldEqual(1); msg[0].ShouldEqual("third"); }
public async Task Throws_exception_if_IHttpContextProvider_not_registered() { var app = new ClientsideFixture <StartupWithContainerWithoutHttpContextAccessor>(); bool thrown = false; Exception ex = new Exception(); try { var msg = await app.RunRulesetAction("/ClientSide/SpecifiedRuleset"); } catch (InvalidOperationException e) { thrown = true; ex = e; } thrown.ShouldBeTrue(); ex.Message.ShouldEqual("Cannot use the RuleSetForClientSideMessagesAttribute unless the IHttpContextAccessor is registered with the service provider. Make sure the provider is registered by calling services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>(); in your Startup class's ConfigureServices method"); }