Пример #1
0
        public async Task 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.
                await 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>();
            }
        }