diff --git a/src/XrmMockupShared/Core.cs b/src/XrmMockupShared/Core.cs index 66ea8d60..6d9b467e 100644 --- a/src/XrmMockupShared/Core.cs +++ b/src/XrmMockupShared/Core.cs @@ -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) diff --git a/src/XrmMockupShared/XrmMockupShared.projitems b/src/XrmMockupShared/XrmMockupShared.projitems index f4e7c199..152a86aa 100644 --- a/src/XrmMockupShared/XrmMockupShared.projitems +++ b/src/XrmMockupShared/XrmMockupShared.projitems @@ -24,6 +24,7 @@ + diff --git a/tests/SharedTests/TestMetadata.cs b/tests/SharedTests/TestMetadata.cs index 412661cf..381466f8 100644 --- a/tests/SharedTests/TestMetadata.cs +++ b/tests/SharedTests/TestMetadata.cs @@ -7,6 +7,7 @@ using Xunit; using System.Linq; using Xunit.Sdk; +using Microsoft.Xrm.Sdk.Metadata.Query; namespace DG.XrmMockupTest { @@ -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); + } } }