Skip to content

Commit bf06b68

Browse files
authored
Update type loader tests (#67)
1 parent 22588d5 commit bf06b68

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

src/Microsoft.Graph.Bicep.Types.UnitTests/MicrosoftGraphTypeLoaderTests.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ namespace Microsoft.Graph.Bicep.Types.UnitTests
1111
[TestClass]
1212
public class MicrosoftGraphTypeLoaderTests
1313
{
14+
private string keyPropertyName = "uniqueName";
15+
1416
private IReadOnlySet<string> availableTypes = new HashSet<string>
1517
{
1618
"Microsoft.Graph/applications@beta",
@@ -20,7 +22,7 @@ public class MicrosoftGraphTypeLoaderTests
2022
"Microsoft.Graph/oauth2PermissionGrants@beta",
2123
};
2224

23-
private IReadOnlySet<string> typesWithRequiredName = new HashSet<string>
25+
private IReadOnlySet<string> typesWithRequiredKey = new HashSet<string>
2426
{
2527
"Microsoft.Graph/applications@beta",
2628
"Microsoft.Graph/groups@beta",
@@ -79,9 +81,11 @@ public void MSGraphTypeLoader_can_load_resources_and_properties()
7981
properties.Should().NotBeNull();
8082
properties.Should().HaveCountGreaterThan(4); // Should at least have id, name, type, and apiVersion
8183

82-
// Check "name" has correct flags
83-
var nameFlags = typesWithRequiredName.Contains(kvp.Key) ? ObjectTypePropertyFlags.Required | ObjectTypePropertyFlags.DeployTimeConstant : ObjectTypePropertyFlags.None;
84-
properties["name"].Flags.Should().HaveFlag(nameFlags);
84+
// Check "uniqueName" has correct flags
85+
if (typesWithRequiredKey.Contains(kvp.Key))
86+
{
87+
properties[keyPropertyName].Flags.Should().HaveFlag(ObjectTypePropertyFlags.Required | ObjectTypePropertyFlags.DeployTimeConstant);
88+
}
8589

8690
// Check directory objects have "id" and "deletedDateTime" properties
8791
if (directoryObjects.Contains(kvp.Key))

0 commit comments

Comments
 (0)