Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
anthony-c-martin committed Jan 27, 2021
1 parent d8e97b3 commit cc171f5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/Bicep.Core.IntegrationTests/Emit/TemplateEmitterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@ public void Emitter_should_generate_correct_extension_scope_property_and_correct
template.SelectToken("$.resources[?(@.name == 'resourceB')].scope")!.ToString().Should().Be("[format('My.Rp/myResource/{0}', 'resourceA')]");
template.SelectToken("$.resources[?(@.name == 'resourceB')].dependsOn[0]")!.ToString().Should().Be("[resourceId('My.Rp/myResource', 'resourceA')]");

template.SelectToken("$.resources[?(@.name == 'resourceC')].scope")!.ToString().Should().Be("[extensionResourceId(format('My.Rp/myResource/{0}', 'resourceA'), 'My.Rp/myResource', 'resourceB')]");
template.SelectToken("$.resources[?(@.name == 'resourceC')].dependsOn[0]")!.ToString().Should().Be("[extensionResourceId(format('My.Rp/myResource/{0}', 'resourceA'), 'My.Rp/myResource', 'resourceB')]");
template.SelectToken("$.resources[?(@.name == 'resourceC')].scope")!.ToString().Should().Be("[extensionResourceId(resourceId('My.Rp/myResource', 'resourceA'), 'My.Rp/myResource', 'resourceB')]");
template.SelectToken("$.resources[?(@.name == 'resourceC')].dependsOn[0]")!.ToString().Should().Be("[extensionResourceId(resourceId('My.Rp/myResource', 'resourceA'), 'My.Rp/myResource', 'resourceB')]");
}
}

Expand Down
10 changes: 5 additions & 5 deletions src/Bicep.Core/TypeSystem/Az/AzResourceTypeProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public static ResourceType SetBicepResourceProperties(ResourceType resourceType,

private static ObjectType SetBicepResourceProperties(ObjectType objectType, Azure.Bicep.Types.Concrete.ScopeType resourceScope, bool isExistingResource)
{
var properties = objectType.Properties.Values;
var properties = objectType.Properties;

var scopeRequiredFlag = TypePropertyFlags.WriteOnly;
if (resourceScope == Azure.Bicep.Types.Concrete.ScopeType.Extension)
Expand All @@ -114,12 +114,12 @@ private static ObjectType SetBicepResourceProperties(ObjectType objectType, Azur
{
// we can refer to a resource at any scope if it is an existing resource not being deployed by this file
var scopeReference = new ResourceScopeType(LanguageConstants.ResourceScopePropertyName, ConvertScopeType(resourceScope));
properties = properties.Append(new TypeProperty(LanguageConstants.ResourceScopePropertyName, scopeReference, scopeRequiredFlag));
properties = properties.SetItem(LanguageConstants.ResourceScopePropertyName, new TypeProperty(LanguageConstants.ResourceScopePropertyName, scopeReference, scopeRequiredFlag));

return new NamedObjectType(
objectType.Name,
objectType.ValidationFlags,
ConvertToReadOnly(properties),
ConvertToReadOnly(properties.Values),
objectType.AdditionalPropertiesType,
ConvertToReadOnly(objectType.AdditionalPropertiesFlags));
}
Expand All @@ -129,13 +129,13 @@ private static ObjectType SetBicepResourceProperties(ObjectType objectType, Azur
if (resourceScope.HasFlag(Azure.Bicep.Types.Concrete.ScopeType.Extension) || resourceScope == Azure.Bicep.Types.Concrete.ScopeType.Unknown)
{
var scopeReference = new ResourceScopeType(LanguageConstants.ResourceScopePropertyName, ResourceScope.Resource);
properties = properties.Append(new TypeProperty(LanguageConstants.ResourceScopePropertyName, scopeReference, scopeRequiredFlag));
properties = properties.SetItem(LanguageConstants.ResourceScopePropertyName, new TypeProperty(LanguageConstants.ResourceScopePropertyName, scopeReference, scopeRequiredFlag));
}

return new NamedObjectType(
objectType.Name,
objectType.ValidationFlags,
properties,
properties.Values,
objectType.AdditionalPropertiesType,
objectType.AdditionalPropertiesFlags);
}
Expand Down

0 comments on commit cc171f5

Please sign in to comment.