public Program() { config = new ConfigurationBuilder().AddJsonFile("appsettings.json", optional: false, reloadOnChange: true).Build(); Personalizer = new PersonalizerService( GetConfigString("PersonalizerEndpointKey"), GetConfigString("PersonalizerResourceName") ); }
public static void AssemblyInit(TestContext context) { IConfiguration config; // Load configuration data found in appsettings.json, need Azure authoring key and resource name to build URL to azure. config = new ConfigurationBuilder().AddJsonFile("appsettings.json", optional: false, reloadOnChange: true).Build(); Personalizer = new PersonalizerService( GetConfigString(config, "PersonalizerEndpointKey"), GetConfigString(config, "PersonalizerResourceName")); }
private static void RunTasteTest(PersonalizerService personalizer) { IList <RankableAction> actions = new List <RankableAction> { new RankableAction { Id = "pasta", Features = new List <object>() { new { taste = "salty", spiceLevel = "medium" }, new { nutritionLevel = 5, cuisine = "italian" } } }, new RankableAction { Id = "salad", Features = new List <object>() { new { taste = "salty", spiceLevel = "low" }, new { nutritionLevel = 8 } } } }; string id = Guid.NewGuid().ToString(); IList <object> currentContext = new List <object>() { new { time = "morning" }, new { taste = "salty" } }; IList <string> exclude = new List <string> { "pasta" }; var request = new RankRequest(actions, currentContext, exclude, id); RankResponse resp = personalizer.Client.Rank(request); Assert.AreEqual("salad", resp.RewardActionId); }