public void ShouldBuildNoHealthCheckWhenUrlNotSet()
        {
            var id = "myservice";

            var manager = new FakeServiceManager
            {
                ServicePort    = 8000,
                ServiceAddress = "localhost",
                ServiceId      = id
            };

            var check = manager.HealthConfig.Build(manager);

            Assert.Null(check);
        }
        public void ShouldBuildExpectedUrl(string url, string expectedUrl)
        {
            var id       = "myservice";
            int interval = 50;

            var manager = new FakeServiceManager
            {
                ServicePort    = 8000,
                ServiceAddress = "localhost",
                ServiceId      = id
            };

            manager.AddHttpHealthCheck(url, interval);

            var check = manager.HealthConfig.Build(manager);

            Assert.Equal(expectedUrl, check.HTTP);
            Assert.Equal($"{interval}s", check.Interval);
            Assert.Equal($"{id}:HttpCheck", check.Name);
        }
        public void ShouldBuildHttpsExpectedUrl(string url, bool ignoreForCheck, string expectedUrl)
        {
            var id       = "myservice";
            int interval = 50;

            var manager = new FakeServiceManager
            {
                ServicePort    = 8000,
                ServiceAddress = "localhost",
                ServiceId      = id
            };

            manager.AddHttpHealthCheck(url, interval);
            manager.UseHttps(ignoreForCheck);

            var check = manager.HealthConfig.Build(manager);

            Assert.Equal(expectedUrl, check.HTTP);
            Assert.Equal(ignoreForCheck, check.tls_skip_verify);
        }
        public void SetUp()
        {
            _optionPageGrid = OptionPageGrid.CreateForTesting();
            _optionPageGrid.NatvisLoggingLevel = NatvisLoggingLevelFeatureFlag.VERBOSE;

            var taskContext    = new JoinableTaskContext();
            var serviceManager = new FakeServiceManager(taskContext);

            serviceManager.AddService(typeof(YetiVSIService), new YetiVSIService(_optionPageGrid));
            _compRoot = new MediumTestDebugEngineFactoryCompRoot(
                serviceManager, taskContext, new GameletClientStub.Factory(),
                TestDummyGenerator.Create <IWindowsRegistry>());

            _varInfoFactory = _compRoot.GetLldbVariableInformationFactory();

            _nLogSpy = _compRoot.GetNatvisDiagnosticLogSpy();
            _nLogSpy.Attach();

            _evaluator = _compRoot.GetNatvisExpressionEvaluator();
        }
Exemplo n.º 5
0
        public void Initialize()
        {
            // Initialize mock service manager
            ServiceManager = new FakeServiceManager();

            // Initialize service collection
            Services = new ServiceCollection();
            Services.AddSingleton(new BotSettings()
            {
                OAuthConnections = new List <OAuthConnection>()
                {
                    new OAuthConnection()
                    {
                        Name = Provider, Provider = Provider
                    }
                }
            });

            Services.AddSingleton(new BotServices()
            {
                CognitiveModelSets = new Dictionary <string, CognitiveModelSet>
                {
                    {
                        "en-us", new CognitiveModelSet()
                        {
                            LuisServices = new Dictionary <string, LuisRecognizer>
                            {
                                { "general", PhoneSkillMockLuisRecognizerFactory.CreateMockGeneralLuisRecognizer() },
                                { "phone", PhoneSkillMockLuisRecognizerFactory.CreateMockPhoneLuisRecognizer() },
                                { "contactSelection", PhoneSkillMockLuisRecognizerFactory.CreateMockContactSelectionLuisRecognizer() },
                                { "phoneNumberSelection", PhoneSkillMockLuisRecognizerFactory.CreateMockPhoneNumberSelectionLuisRecognizer() },
                            }
                        }
                    }
                }
            });

            Services.AddSingleton <IBotTelemetryClient, NullBotTelemetryClient>();
            Services.AddSingleton(new UserState(new MemoryStorage()));
            Services.AddSingleton(new ConversationState(new MemoryStorage()));
            Services.AddSingleton(new ProactiveState(new MemoryStorage()));
            Services.AddSingleton(sp =>
            {
                var userState         = sp.GetService <UserState>();
                var conversationState = sp.GetService <ConversationState>();
                var proactiveState    = sp.GetService <ProactiveState>();
                return(new BotStateSet(userState, conversationState));
            });

            // Configure localized responses
            TemplateManager = LocaleTemplateManagerWrapper.CreateLocaleTemplateManager("en-us");
            Services.AddSingleton(TemplateManager);
            Templates = LocaleTemplateManagerWrapper.CreateTemplates();

            Services.AddSingleton <IBackgroundTaskQueue, BackgroundTaskQueue>();
            Services.AddSingleton <IServiceManager>(ServiceManager);
            Services.AddSingleton <TestAdapter, DefaultTestAdapter>();
            Services.AddTransient <MainDialog>();
            Services.AddTransient <OutgoingCallDialog>();
            Services.AddTransient <IBot, DefaultActivityHandler <MainDialog> >();
        }