示例#1
0
        public void CanGetNamedRequiredService()
        {
            var configuration = new BotConfiguration();

            configuration.ConnectService(new LuisService()
            {
                AppId           = Guid.NewGuid().ToString(),
                Name            = "Development-luis",
                Region          = "WestEurope",
                SubscriptionKey = Guid.NewGuid().ToString()
            });

            var serviceInstance = configuration.GetRequiredService <LuisService>("Development", "luis");

            Assert.NotNull(serviceInstance);
        }
示例#2
0
        public void RaisesExceptionForNonExistingRequiredService()
        {
            var configuration = new BotConfiguration();

            configuration.ConnectService(new LuisService()
            {
                AppId           = Guid.NewGuid().ToString(),
                Name            = "Production",
                Region          = "WestEurope",
                SubscriptionKey = Guid.NewGuid().ToString()
            });

            Assert.Throws <KeyNotFoundException>(() =>
            {
                configuration.GetRequiredService <LuisService>("Development");
            });
        }