Skip to content

Commit

Permalink
Luis Authoring modified SDK tests (Azure#7408)
Browse files Browse the repository at this point in the history
* new modified tests luis authoring

* fixing long path issue
  • Loading branch information
omarsgalal authored and kayousef committed Aug 27, 2019
1 parent 4acb016 commit 0e7ec14
Show file tree
Hide file tree
Showing 177 changed files with 8,465 additions and 7,315 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ public abstract class BaseTest
{
private const HttpRecorderMode mode = HttpRecorderMode.Playback;

protected readonly Guid GlobalAppId = new Guid("741516ba-5148-4f5c-91cc-f25d10d3a22e");
protected readonly Guid GlobalAppId = new Guid("3327b33c-35df-40d0-a661-c9ade29da239");
protected const string GlobalVersionId = "0.1";
protected readonly Guid GlobalAppIdError = new Guid("86226c53-b7a6-416f-876b-226b2b5ab07d");
protected readonly Guid GlobalNoneId = new Guid("9a3fce96-2ab4-4f88-ba80-2011731e3188");
protected readonly Guid GlobalNoneId = new Guid("ac04c5c6-2c0c-4af8-ba3f-5db090fa7de5");
protected const string AuthoringKey = "00000000000000000000000000000000";
protected readonly string OwnerEmail = "[email protected]";


private Type TypeName => GetType();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Xunit;
using System.Linq;

[Collection("TestCollection")]
public class AppsTests : BaseTest
{
[Fact]
Expand Down Expand Up @@ -385,7 +386,7 @@ public void ListAvailableCustomPrebuiltDomains()
});
}

[Fact]
[Fact (Skip = "Problem from API")]
public void ListAvailableCustomPrebuiltDomainsForCulture()
{
UseClientFor(async client =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace LUIS.Authoring.Tests.Luis
using System.Text;
using Xunit;

[Collection("TestCollection")]
public class EntityRolesTests : BaseTest
{
[Fact]
Expand Down Expand Up @@ -155,15 +156,16 @@ public void AddHierarchicalEntityRole()
Name = "Pattern.Any model",
Children = new[] { "child1" }
});

var roleId = await client.Model.CreateHierarchicalEntityRoleAsync(GlobalAppId, "0.1", entityId, new EntityRoleCreateObject
var exception = await Assert.ThrowsAsync<ErrorResponseException>(async () => await client.Model.CreateHierarchicalEntityRoleAsync(GlobalAppId, "0.1", entityId, new EntityRoleCreateObject
{
Name = "simple role"
});
var roles = await client.Model.ListHierarchicalEntityRolesAsync(GlobalAppId, "0.1", entityId);
}));
await client.Model.DeleteHierarchicalEntityAsync(GlobalAppId, "0.1", entityId);

Assert.Contains(roles, r => r.Name == "simple role");
var error = exception.Body;
var errorCode = "BadArgument";

Assert.Equal(errorCode, error.Code);
});
}

Expand Down Expand Up @@ -323,28 +325,6 @@ public void GetPatternAnyEntityRole()
});
}

[Fact]
public void GetHierarchicalEntityRole()
{
UseClientFor(async client =>
{
var entityId = await client.Model.AddHierarchicalEntityAsync(GlobalAppId, "0.1", new HierarchicalEntityModel
{
Name = "Pattern.Any model",
Children = new[] { "child1" }
});

var roleId = await client.Model.CreateHierarchicalEntityRoleAsync(GlobalAppId, "0.1", entityId, new EntityRoleCreateObject
{
Name = "simple role"
});
var role = await client.Model.GetHierarchicalEntityRoleAsync(GlobalAppId, "0.1", entityId, roleId);
await client.Model.DeleteHierarchicalEntityAsync(GlobalAppId, "0.1", entityId);

Assert.Equal("simple role", role.Name);
});
}

[Fact]
public void GetCustomPrebuiltDomainEntityRole()
{
Expand Down Expand Up @@ -501,28 +481,6 @@ public void GetPatternAnyEntityRoles()
});
}

[Fact]
public void GetHierarchicalEntityRoles()
{
UseClientFor(async client =>
{
var entityId = await client.Model.AddHierarchicalEntityAsync(GlobalAppId, "0.1", new HierarchicalEntityModel
{
Name = "Pattern.Any model",
Children = new[] { "child1" }
});

var roleId = await client.Model.CreateHierarchicalEntityRoleAsync(GlobalAppId, "0.1", entityId, new EntityRoleCreateObject
{
Name = "simple role"
});
var roles = await client.Model.ListHierarchicalEntityRolesAsync(GlobalAppId, "0.1", entityId);
await client.Model.DeleteHierarchicalEntityAsync(GlobalAppId, "0.1", entityId);

Assert.Equal("simple role", Assert.Single(roles).Name);
});
}

[Fact]
public void GetCustomPrebuiltDomainEntityRoles()
{
Expand Down Expand Up @@ -703,32 +661,6 @@ public void UpdatePatternAnyEntityRole()
});
}

[Fact]
public void UpdateHierarchicalEntityRole()
{
UseClientFor(async client =>
{
var entityId = await client.Model.AddHierarchicalEntityAsync(GlobalAppId, "0.1", new HierarchicalEntityModel
{
Name = "Pattern.Any model",
Children = new[] { "child1" }
});

var roleId = await client.Model.CreateHierarchicalEntityRoleAsync(GlobalAppId, "0.1", entityId, new EntityRoleCreateObject
{
Name = "simple role"
});
await client.Model.UpdateHierarchicalEntityRoleAsync(GlobalAppId, "0.1", entityId, roleId, new EntityRoleUpdateObject
{
Name = "simple role 2"
});
var role = await client.Model.GetHierarchicalEntityRoleAsync(GlobalAppId, "0.1", entityId, roleId);
await client.Model.DeleteHierarchicalEntityAsync(GlobalAppId, "0.1", entityId);

Assert.Equal("simple role 2", role.Name);
});
}

[Fact]
public void UpdateCustomPrebuiltDomainEntityRole()
{
Expand Down Expand Up @@ -895,29 +827,6 @@ public void DeletePatternAnyEntityRole()
});
}

[Fact]
public void DeleteHierarchicalEntityRole()
{
UseClientFor(async client =>
{
var entityId = await client.Model.AddHierarchicalEntityAsync(GlobalAppId, "0.1", new HierarchicalEntityModel
{
Name = "Pattern.Any model",
Children = new[] { "child1" }
});

var roleId = await client.Model.CreateHierarchicalEntityRoleAsync(GlobalAppId, "0.1", entityId, new EntityRoleCreateObject
{
Name = "simple role"
});
await client.Model.DeleteHierarchicalEntityRoleAsync(GlobalAppId, "0.1", entityId, roleId);
var roles = await client.Model.ListHierarchicalEntityRolesAsync(GlobalAppId, "0.1", entityId);
await client.Model.DeleteHierarchicalEntityAsync(GlobalAppId, "0.1", entityId);

Assert.Empty(roles);
});
}

[Fact]
public void DeleteCustomPrebuiltDomainEntityRole()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Microsoft.Azure.CognitiveServices.Language.LUIS.Authoring.Models;
using Xunit;

[Collection("TestCollection")]
public class ExamplesTests : BaseTest
{
private const string versionId = "0.1";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Microsoft.Azure.CognitiveServices.Language.LUIS.Authoring.Models;
using Xunit;

[Collection("TestCollection")]
public class FeaturesPhraseListsTests : BaseTest
{
private const string versionId = "0.1";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.IO;
using Xunit;

[Collection("TestCollection")]
public class FeaturesTests : BaseTest
{
[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Newtonsoft.Json;
using Xunit;

[Collection("TestCollection")]
public class ImportExportTests : BaseTest
{
private const string versionId = "0.1";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Microsoft.Azure.CognitiveServices.Language.LUIS.Authoring.Models;
using Xunit;

[Collection("TestCollection")]
public class ModelClosedListsTests : BaseTest
{
private const string versionId = "0.1";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Microsoft.Azure.CognitiveServices.Language.LUIS.Authoring.Models;
using Xunit;

[Collection("TestCollection")]
public class ModelSimpleEntitiesTests : BaseTest
{
private const string versionId = "0.1";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Microsoft.Azure.CognitiveServices.Language.LUIS.Authoring.Models;
using Xunit;

[Collection("TestCollection")]
public class ModelIntentsTests : BaseTest
{
private const string versionId = "0.1";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Microsoft.Azure.CognitiveServices.Language.LUIS.Authoring.Models;
using Xunit;

[Collection("TestCollection")]
public class ModelPatternAnyTests : BaseTest
{
private const string versionId = "0.1";
Expand Down
Loading

0 comments on commit 0e7ec14

Please sign in to comment.