Ejemplo n.º 1
0
        public static void InitializeMocksToEnableInvocation(ScenarioContext scenarioContext)
        {
            OperationInvokerTestContext invokerContext = ContainerBindings.GetServiceProvider(scenarioContext).GetRequiredService <OperationInvokerTestContext>();

            invokerContext.ParameterBuilder
            .Setup(pb => pb.BuildParametersAsync(It.IsAny <object>(), It.IsAny <OpenApiOperationPathTemplate>()))
            .ReturnsAsync(new Dictionary <string, object>());
        }
Ejemplo n.º 2
0
        public static void InitializeContainer(ScenarioContext scenarioContext)
        {
            ContainerBindings.ConfigureServices(
                scenarioContext,
                serviceCollection =>
            {
                serviceCollection.AddLogging();
                serviceCollection.AddOpenApiHttpRequestHosting <SimpleOpenApiContext>(null);

                var instrumentationProvider = new FakeInstrumentationProvider();
                serviceCollection.AddSingleton(instrumentationProvider);
                serviceCollection.AddSingleton <IOperationsInstrumentation>(instrumentationProvider);
                serviceCollection.AddSingleton <IExceptionsInstrumentation>(instrumentationProvider);
                serviceCollection.AddInstrumentation();
                serviceCollection.AddInstrumentationSourceTagging();

                OperationInvokerTestContext.AddServices(serviceCollection);
            });
        }