示例#1
0
        static void Main(string[] args)
        {
            string          buffer  = getStdin();
            var             context = new DefaultFunctionContext();
            FunctionHandler f       = new FunctionHandler(context);

            f.Handle(buffer);
        }
示例#2
0
        static void Main(string[] args)
        {
            string buffer  = Console.In.ReadToEnd();
            var    context = new DefaultFunctionContext();

            FunctionHandler f             = new FunctionHandler(context);
            string          responseValue = f.Handle(buffer);

            if (responseValue != null)
            {
                Console.Write(responseValue);
            }
        }
        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);
        }