public async Task When_an_unrecognized_directive_is_encountered_it_is_forwarded_to_the_kernel_as_submitCode() { SubmitCode submitCommand = null; using var kernel = new CompositeKernel { new FakeKernel("csharp") { Handle = (command, context) => { submitCommand = command as SubmitCode; return(Task.CompletedTask); } } }; using var events = kernel.KernelEvents.ToSubscribedList(); await kernel.SubmitCodeAsync("#!undefinedDirective"); using var _ = new AssertionScope(); submitCommand.Should().NotBeNull(); submitCommand.Code.Should().Be("#!undefinedDirective"); }
public void When_created_in_the_same_context_then_child_commands_having_the_same_parent_also_have_the_same_token() { var parentCommand = new SubmitCode("123"); string token1 = null; string token2 = null; using (KernelInvocationContext.Establish(parentCommand)) { token1 = new SubmitCode("456").GetToken(); token2 = new SubmitCode("456").GetToken(); } token1.Should().Be(token2); }
public void When_resent_then_child_commands_having_the_same_parent_have_repeatable_tokens() { var parentCommand = new SubmitCode("123"); parentCommand.SetToken("the-token"); string token1 = null; string token2 = null; using (KernelInvocationContext.Establish(parentCommand)) { token1 = new SubmitCode("456").GetToken(); } using (KernelInvocationContext.Establish(parentCommand)) { token2 = new SubmitCode("456").GetToken(); } token1.Should().Be(token2); }