Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions .claude/settings.local.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
{
"permissions": {
"allow": [
"Bash(yarn nx g:*)",
"Bash(npx vitest:*)",
"Bash(xargs:*)",
"Bash(dotnet build:*)",
"Bash(git show:*)"
]
"allow": []
}
}
Comment on lines 1 to 5
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ protected virtual ExtensionPropertyDto CreateExtensionPropertyDto(
{
GlobalFeatures = new ExtensionPropertyGlobalFeaturePolicyDto
{
Features = propertyConfig.Policy.Features.Features,
RequiresAll = propertyConfig.Policy.Features.RequiresAll
Features = propertyConfig.Policy.GlobalFeatures.Features,
RequiresAll = propertyConfig.Policy.GlobalFeatures.RequiresAll
},
Features = new ExtensionPropertyFeaturePolicyDto
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using Shouldly;
using Volo.Abp.ObjectExtending;
using Volo.Abp.ObjectExtending.Modularity;
using Xunit;

namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending;

public class CachedObjectExtensionsDtoService_Tests
{
private const string ModuleName = "CachedObjectExtensionsDtoServiceTestModule";
private const string EntityName = "TestEntity";

[Fact]
public void Should_Keep_The_Feature_And_Global_Feature_Policies_Apart()
{
ObjectExtensionManager.Instance.Modules()
.ConfigureModule<ModuleExtensionConfiguration>(ModuleName, module =>
{
module.ConfigureEntity(EntityName, entity =>
{
entity.AddOrUpdateProperty<string>("TestProperty", property =>
{
property.Policy.Features.Features = ["TestFeature"];
property.Policy.Features.RequiresAll = true;
property.Policy.GlobalFeatures.Features = ["TestGlobalFeature"];
property.Policy.GlobalFeatures.RequiresAll = false;
});
});
});

var service = new CachedObjectExtensionsDtoService(new ExtensionPropertyAttributeDtoFactory());

var policy = service.Get()
.Modules[ModuleName]
.Entities[EntityName]
.Properties["TestProperty"]
.Policy;

policy.Features.Features.ShouldBe(["TestFeature"]);
policy.Features.RequiresAll.ShouldBeTrue();
policy.GlobalFeatures.Features.ShouldBe(["TestGlobalFeature"]);
policy.GlobalFeatures.RequiresAll.ShouldBeFalse();
}
}
Loading