public async Task ShouldThrowExceptionOnRenameAppSDKTestWhenExistsAppWithSameName() { using (var client = new LuisProgClient(SubscriptionKey, Region)) { var app = await client.GetAppByNameAsync("SDKTest"); var appChanged = await client.GetAppByNameAsync("SDKTestChanged"); string appChangedId = null; if (app == null) { await client.AddAppAsync("SDKTest", "Description test", "en-us", "SDKTest", string.Empty, appVersion); app = await client.GetAppByNameAsync("SDKTest"); } if (appChanged == null) { appChangedId = await client.AddAppAsync("SDKTestChanged", "Description changed", "en-us", "SDKTest", string.Empty, appVersion); } var ex = await Assert.ThrowsExceptionAsync <Exception>(() => client.RenameAppAsync(app.Id, "SDKTestChanged", "Description changed")); Assert.AreEqual(ex.Message, "BadArgument - SDKTestChanged already exists."); } }
public async Task ShouldThrowExceptionOnRenameAppSDKTestWhenExistsAppWithSameName() { var client = new LuisProgClient(SUBSCRIPTION_KEY, LOCATION); var app = await client.GetAppByNameAsync("SDKTest"); var appChanged = await client.GetAppByNameAsync("SDKTestChanged"); string appChangedId = null; if (app == null) { await client.AddAppAsync("SDKTest", "Description test", "en-us", "SDKTest", string.Empty, "1.0"); app = await client.GetAppByNameAsync("SDKTest"); } if (appChanged == null) { appChangedId = await client.AddAppAsync("SDKTestChanged", "Description changed", "en-us", "SDKTest", string.Empty, "1.0"); } var ex = await Assert.ThrowsExceptionAsync <Exception>(() => client.RenameAppAsync(app.Id, "SDKTestChanged", "Description changed")); Assert.AreEqual(ex.Message, "An application with the same name already exists"); }
public async Task ShouldRenameAppSDKTest() { using (var client = new LuisProgClient(SubscriptionKey, Region)) { var app = await client.GetAppByNameAsync("SDKTest"); var appChanged = await client.GetAppByNameAsync("SDKTestChanged"); if (app == null) { await client.AddAppAsync("SDKTest", "Description test", "en-us", "SDKTest", string.Empty, appVersion); app = await client.GetAppByNameAsync("SDKTest"); } if (appChanged != null) { await client.DeleteAppAsync(appChanged.Id); } await client.RenameAppAsync(app.Id, "SDKTestChanged", "Description changed"); app = await client.GetAppByIdAsync(app.Id); Assert.AreEqual("SDKTestChanged", app.Name); } }
public async Task ShouldRenameAppSDKTest() { var client = new LuisProgClient(SUBSCRIPTION_KEY, LOCATION); var app = await client.GetAppByNameAsync("SDKTest"); var appChanged = await client.GetAppByNameAsync("SDKTestChanged"); if (app == null) { await client.AddAppAsync("SDKTest", "Description test", "en-us", "SDKTest", string.Empty, "1.0"); app = await client.GetAppByNameAsync("SDKTest"); } if (appChanged != null) { await client.DeleteAppAsync(appChanged.Id); } await client.RenameAppAsync(app.Id, "SDKTestChanged", "Description changed"); app = await client.GetAppByIdAsync(app.Id); Assert.AreEqual("SDKTestChanged", app.Name); }
public PublishTests() { var client = new LuisProgClient(SUBSCRIPTION_KEY, LOCATION); var app = client.GetAppByNameAsync("SDKTest").Result; if (app != null) { client.DeleteAppAsync(app.Id).Wait(); _appId = client.AddAppAsync("SDKTest", "Description test", "en-us", "SDKTest", string.Empty, "1.0").Result; } else { _appId = client.AddAppAsync("SDKTest", "Description test", "en-us", "SDKTest", string.Empty, "1.0").Result; } }
public async Task ShouldThrowExceptionOnAddNewAppSDKTestWhenAlreadyExists() { var client = new LuisProgClient(SUBSCRIPTION_KEY, LOCATION); var ex = await Assert.ThrowsExceptionAsync <Exception>(() => client.AddAppAsync("SDKTest", "Description test", "en-us", "SDKTest", string.Empty, "1.0")); Assert.AreEqual(ex.Message, "An application with the same name already exists"); }
public async Task ShouldThrowExceptionOnAddNewAppSDKTestWhenAlreadyExists() { using (var client = new LuisProgClient(SubscriptionKey, Region)) { var ex = await Assert.ThrowsExceptionAsync <Exception>(() => client.AddAppAsync("SDKTest", "Description test", "en-us", "SDKTest", string.Empty, appVersion)); Assert.AreEqual(ex.Message, "BadArgument - SDKTest already exists."); } }
public async Task ShouldGetAppByName() { var client = new LuisProgClient(SUBSCRIPTION_KEY, LOCATION); if (await client.GetAppByNameAsync("SDKTest") == null) { await client.AddAppAsync("SDKTest", "Description test", "en-us", "SDKTest", string.Empty, "1.0"); } var app = await client.GetAppByNameAsync("SDKTest"); Assert.IsNotNull(app); }
public async Task ShouldGetAppByName() { using (var client = new LuisProgClient(SubscriptionKey, Region)) { if (await client.GetAppByNameAsync("SDKTest") == null) { await client.AddAppAsync("SDKTest", "Description test", "en-us", "SDKTest", string.Empty, appVersion); } var app = await client.GetAppByNameAsync("SDKTest"); Assert.IsNotNull(app); } }
protected static void Initialize() { var client = new LuisProgClient(SubscriptionKey, Region); var app = client.GetAppByNameAsync("SDKTest").Result; if (app != null) { appId = app.Id; } else { appId = client.AddAppAsync("SDKTest", "Description test", "en-us", "SDKTest", string.Empty, appVersion).Result; } }
public async Task ShouldAddNewAppSDKTest() { var client = new LuisProgClient(SUBSCRIPTION_KEY, LOCATION); var appTest = await client.GetAppByNameAsync("SDKTest"); if (appTest != null) { await client.DeleteAppAsync(appTest.Id); } var newId = await client.AddAppAsync("SDKTest", "Description test", "en-us", "SDKTest", string.Empty, "1.0"); Assert.IsNotNull(newId); }
public async Task ShouldAddNewAppSDKTest() { using (var client = new LuisProgClient(SubscriptionKey, Region)) { var appTest = await client.GetAppByNameAsync("SDKTest"); if (appTest != null) { await client.DeleteAppAsync(appTest.Id); } var newId = await client.AddAppAsync("SDKTest", "Description test", "en-us", "SDKTest", string.Empty, appVersion); Assert.IsNotNull(newId); } }