Exemplo n.º 1
0
 void RegisterServiceImplementors()
 {
     if (WebTestManager.IsTddExecutionMode())
     {
         // TODO: Add real service implementors:
         // e.g. CurrencyService.RegisterImplementor<European.Central.Bank.FakeCurrencyServiceImplementor>();
     }
     else
     {
         // TODO: Register fake service implementors:
         // e.g. CurrencyService.RegisterImplementor<European.Central.Bank.CurrencyServiceImplementor>();
     }
 }
        public static HtmlString ResetDatabaseLink(this IHtmlHelper html)
        {
            if (!WebTestManager.IsTddExecutionMode())
            {
                return(null);
            }

            if (html.Request().IsAjaxCall())
            {
                return(null);
            }

            if (WebTestManager.IsSanityExecutionMode())
            {
                html.RunJavascript("page.skipNewWindows();");
            }

            return(new HtmlString(WebTestManager.GetWebTestWidgetHtml(Context.Http.Request)));
        }
Exemplo n.º 3
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public virtual void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            InitializeDatabase(app, env);

            app.ConfigureOliveDependencies(env);

            ConfigureExceptionPage(app, env);

            if (WebTestManager.IsTddExecutionMode())
            {
                app.UseWebTestMiddleware();
            }

            app.UseAuthentication()
            .UseStaticFiles()
            .UseRequestLocalization(RequestLocalizationOptions)
            .UseSession()
            .UseMvc(ConfigureRoutes);

            WebTestManager.CreateReferenceDataBy(CreateReferenceData);

            Task.Factory.RunSync(() => WebTestManager.InitiateTempDatabase(enforceRestart: false, mustRenew: false));
        }
Exemplo n.º 4
0
        public void Global_ASAX()
        {
            // The actual service implementation will be registerd here once for live use (non-test mode).
            // Throughout the development period when the application is in TDD mode, this service is essentially not registered, so
            // there is no dependency on the external service.

            // Perhaps only once when the ServiceImplementation is created during development cycle,
            // you can remove the condition to test it once or twice.
            if (WebTestManager.IsTddExecutionMode() == false)
            {
                MyService.RegisterImplementor <My.VSProject.MyServiceImplementor>();

                // Optional: Add an Automated Task to call the following.
                // It will frequently process all outstanding items in the queue.
                // Mainly relevant for multi-try situations in live operations. Avoid unless necessary.
                IntegrationManager.ProcessOutstandingItems();
            }
            else
            {
                // Note: In case you need to provide a Mock implementation for the service, instead of manually injecting the responses
                // through sanity, you can create a class that fakes responses to requests and inject it here:
                // e.g: MyService.Register<My.VSProject.MyServiceMockImplementation>();
            }
        }