public void Get_Retrieves_Set_Services() { var features = new InvocationFeatures(Enumerable.Empty <IInvocationFeatureProvider>()); features.Set <string>("test"); string result = features.Get <string>(); Assert.Equal("test", result); }
public DefaultFunctionContextTests() { IServiceCollection serviceCollection = new ServiceCollection(); serviceCollection.AddSingleton <SingletonService>(); serviceCollection.AddTransient <TransientService>(); serviceCollection.AddScoped <ScopedService>(); _serviceProvider = serviceCollection.BuildServiceProvider(); _serviceScopeFactory = _serviceProvider.GetService <IServiceScopeFactory>(); var invocation = new Mock <FunctionInvocation>(MockBehavior.Strict).Object; var definition = new Mock <FunctionDefinition>(MockBehavior.Strict).Object; var features = new InvocationFeatures(Enumerable.Empty <IInvocationFeatureProvider>()); features.Set <FunctionDefinition>(definition); features.Set <FunctionInvocation>(invocation); _defaultFunctionContext = new DefaultFunctionContext(_serviceScopeFactory, features); }