Skip to content

Commit

Permalink
Merge pull request #136 from MattTrinder1/135_metatdata_changes
Browse files Browse the repository at this point in the history
135 metatdata changes
  • Loading branch information
magesoe authored Jan 22, 2021
2 parents 42c024d + 330cb5f commit 9c4c092
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/XrmMockupShared/Core.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ private void InitializeDB()
new RetrieveAttributeRequestHandler(this, db, metadata, security),
new WhoAmIRequestHandler(this, db, metadata, security),
new RetrievePrincipalAccessRequestHandler(this, db, metadata, security),
new RetrieveMetadataChangesRequestHandler(this, db, metadata, security)
};

internal void EnableProxyTypes(Assembly assembly)
Expand Down
1 change: 1 addition & 0 deletions src/XrmMockupShared/XrmMockupShared.projitems
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Requests\RemoveMembersTeamRequestHandler.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Requests\CloseIncidentRequestHandler.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Requests\IsValidStateTransitionRequestHandler.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Requests\RetrieveMetadataChangesRequestHandler.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Requests\RetrievePrincipalAccessRequestHandler.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Requests\RetrieveAttributeRequestHandler.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Requests\RetrieveExchangeRateRequestHandler.cs" />
Expand Down
23 changes: 23 additions & 0 deletions tests/SharedTests/TestMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Xunit;
using System.Linq;
using Xunit.Sdk;
using Microsoft.Xrm.Sdk.Metadata.Query;

namespace DG.XrmMockupTest
{
Expand Down Expand Up @@ -208,6 +209,28 @@ public void RetrieveDefaultFilteredEntityMetadata()
Assert.Null(resp.EntityMetadata.Attributes);
}

[Fact]
public void RetrieveMetadataChangesRequest()
{
var entityFilter = new MetadataFilterExpression(LogicalOperator.And);
entityFilter.Conditions.Add(new MetadataConditionExpression("ObjectTypeCode ", MetadataConditionOperator.Equals, 1));
var propertyExpression = new MetadataPropertiesExpression { AllProperties = false };
propertyExpression.PropertyNames.Add("LogicalName");
var entityQueryExpression = new EntityQueryExpression()
{
Criteria = entityFilter,
Properties = propertyExpression
};

var retrieveMetadataChangesRequest = new RetrieveMetadataChangesRequest()
{
Query = entityQueryExpression
};

var response = (RetrieveMetadataChangesResponse)orgAdminService.Execute(retrieveMetadataChangesRequest);

Assert.Equal("account", response.EntityMetadata[0].LogicalName);
}
}

}

0 comments on commit 9c4c092

Please sign in to comment.