public async Task ShouldRenameEntityTest() { using (var client = new LuisProgClient(SubscriptionKey, Region)) { var entity = await client.GetEntityByNameAsync(EntityName, appId, appVersion); var entityChanged = await client.GetEntityByNameAsync(EntityNameChanged, appId, appVersion); if (entity == null) { await client.AddEntityAsync(EntityName, appId, appVersion); entity = await client.GetEntityByNameAsync(EntityName, appId, appVersion); } if (entityChanged != null) { await client.DeleteEntityAsync(entityChanged.Id, appId, appVersion); } await client.RenameEntityAsync(entity.Id, EntityNameChanged, appId, appVersion); entity = await client.GetEntityByIdAsync(entity.Id, appId, appVersion); Assert.AreEqual(EntityNameChanged, entity.Name); } }
public async Task ShouldRenameEntityTest() { var client = new LuisProgClient(SUBSCRIPTION_KEY, LOCATION); var entity = await client.GetEntityByNameAsync("EntityTest", _appId, "1.0"); var entityChanged = await client.GetEntityByNameAsync("EntityTestChanged", _appId, "1.0"); if (entity == null) { await client.AddEntityAsync("EntityTest", _appId, "1.0"); entity = await client.GetEntityByNameAsync("EntityTest", _appId, "1.0"); } if (entityChanged != null) { await client.DeleteEntityAsync(entityChanged.Id, _appId, "1.0"); } await client.RenameEntityAsync(entity.Id, "EntityTestChanged", _appId, "1.0"); entity = await client.GetEntityByIdAsync(entity.Id, _appId, "1.0"); Assert.AreEqual("EntityTestChanged", entity.Name); }
public async Task ShouldGetNullWhenNotExistsEntityId() { var client = new LuisProgClient(SUBSCRIPTION_KEY, LOCATION); var entity = await client.GetEntityByIdAsync("51593248-363e-4a08-b946-2061964dc690", _appId, "1.0"); Assert.IsNull(entity); }
public async Task ShouldGetNullWhenNotExistsEntityId() { using (var client = new LuisProgClient(SubscriptionKey, Region)) { var entity = await client.GetEntityByIdAsync(InvalidId, appId, appVersion); Assert.IsNull(entity); } }
public async Task ShouldDeleteEntityTest() { var client = new LuisProgClient(SUBSCRIPTION_KEY, LOCATION); if (await client.GetEntityByNameAsync("EntityTest", _appId, "1.0") == null) { await client.AddEntityAsync("EntityTest", _appId, "1.0"); } var entity = await client.GetEntityByNameAsync("EntityTest", _appId, "1.0"); await client.DeleteEntityAsync(entity.Id, _appId, "1.0"); entity = await client.GetEntityByIdAsync(entity.Id, _appId, "1.0"); Assert.IsNull(entity); }
public async Task ShouldDeleteEntityTest() { using (var client = new LuisProgClient(SubscriptionKey, Region)) { if (await client.GetEntityByNameAsync(EntityName, appId, appVersion) == null) { await client.AddEntityAsync(EntityName, appId, appVersion); } var entity = await client.GetEntityByNameAsync(EntityName, appId, appVersion); await client.DeleteEntityAsync(entity.Id, appId, appVersion); entity = await client.GetEntityByIdAsync(entity.Id, appId, appVersion); Assert.IsNull(entity); } }
public async Task ShouldGetExistEntityById() { var client = new LuisProgClient(SUBSCRIPTION_KEY, LOCATION); var entities = await client.GetAllEntitiesAsync(_appId, "1.0"); if (entities.Count == 0) { await client.AddEntityAsync("EntityTest", _appId, "1.0"); entities = await client.GetAllEntitiesAsync(_appId, "1.0"); } var firstEntity = entities.FirstOrDefault(); var entity = await client.GetEntityByIdAsync(firstEntity.Id, _appId, "1.0"); Assert.AreEqual(firstEntity.Name, entity.Name); }
public async Task ShouldGetExistEntityById() { using (var client = new LuisProgClient(SubscriptionKey, Region)) { var entities = await client.GetAllEntitiesAsync(appId, appVersion); if (entities.Count == 0) { await client.AddEntityAsync(EntityName, appId, appVersion); entities = await client.GetAllEntitiesAsync(appId, appVersion); } var firstEntity = entities.FirstOrDefault(); var entity = await client.GetEntityByIdAsync(firstEntity.Id, appId, appVersion); Assert.AreEqual(firstEntity.Name, entity.Name); } }