public async Task When_Dependency_From_Operation_Context_And_IoC_Then_Injects() { // Arrange var operation = new InlineHandle(); var executor = TestApiOperationExecutor.CreateStandalone( o => o .WithOperation <InlineHandle>() .AddAuthentication(a => a.UseContextLoader <AnonymousUserAuthorisationContextFactory>()) .AddAuthorisation(), s => { s.AddSingleton <IClaimsIdentityProvider, NullClaimsIdentityProvider>(); s.AddTransient <IDependency, Dependency>(); }); // Act await executor.ExecuteWithNewScopeAsync(operation); // Assert operation.Context.Should().NotBeNull(); operation.Context.Operation.Should().Be(operation); operation.Dependency.Should().NotBeNull(); operation.User.Should().NotBeNull(); }
public async Task When_Dependency_From_Operation_Context_And_IoC_Then_Injects() { // Arrange var operation = new InlineHandle(); var executor = TestApiOperationExecutor.CreateStandalone( o => o.WithOperation <InlineHandle>(), s => s.AddTransient <IDependency, Dependency>()); // Act await executor.ExecuteWithNewScopeAsync(operation); // Assert operation.Context.Should().NotBeNull(); operation.Context.Operation.Should().Be(operation); operation.Dependency.Should().NotBeNull(); }