Exemple #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            var coreBootstrapper = new CoreBootstrapper();

            services.AddSingleton <IFunctionsProvider, FunctionsProvider>();
            services.AddSingleton <IScriptsProvider, ScriptsProvider>();
            services.AddSingleton <IAutocompleteProvider, AutocompleteProvider>(isp => coreBootstrapper.Create <AutocompleteProvider>());
            services.AddSingleton <IExpressionsEvaluator, ExpressionsEvaluator>(isp => coreBootstrapper.Create <ExpressionsEvaluator>());
            services.AddSingleton <IScriptEvaluator, ScriptEvaluator>(isp => coreBootstrapper.Create <ScriptEvaluator>());
            services.AddSingleton <IModeDeterminer, ModeDeterminer>(isp => coreBootstrapper.Create <ModeDeterminer>());
            services.AddSingleton <IChartFactory>(isp => RuntimeObjectFactory.CreateInstance <IChartFactory>("Charting"));

            services.AddCors();

            // Add framework services.
            services.AddMvc();

            // Register the Swagger generator, defining one or more Swagger documents
            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new Info {
                    Title = "Computator.NET.Web API", Version = "v1"
                });
            });
        }
Exemple #2
0
        private void SetupBase(string opeartion, string method, string expression)
        {
            _expressionViewMock.SetupGet(m => m.Text).Returns(expression);

            _numericalCalculationsViewMock.SetupGet(m => m.SelectedOperation).Returns(opeartion);
            _numericalCalculationsViewMock.SetupGet(m => m.SelectedMethod).Returns(method);

            _numericalCalculationsPresenter = _bootstrapper.Create <NumericalCalculationsPresenter>();

            EventAggregator.Instance.Publish(new CalculationsModeChangedEvent(CalculationsMode.Real));
        }