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); }
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"); }); }