From 876ecf786fb87411b9d1f6f1237e622a010b7778 Mon Sep 17 00:00:00 2001 From: Matt Trinder Date: Thu, 7 Jan 2021 16:10:38 +0000 Subject: [PATCH 1/3] failing test --- tests/SharedTests/TestMetadata.cs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/SharedTests/TestMetadata.cs b/tests/SharedTests/TestMetadata.cs index 412661cf..949d9ed4 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,29 @@ 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); + + } } } From ee1fa2ca276e7136cf22aea5a75a40796e13f1a9 Mon Sep 17 00:00:00 2001 From: Matt Trinder Date: Thu, 7 Jan 2021 16:17:08 +0000 Subject: [PATCH 2/3] first draft - incomplete but retrieves entities by object type code --- src/XrmMockupShared/Core.cs | 1 + src/XrmMockupShared/XrmMockupShared.projitems | 1 + 2 files changed, 2 insertions(+) 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 @@ + From 330cb5fe0c7c5d870d0d693114835160ee3a18e8 Mon Sep 17 00:00:00 2001 From: Matt Trinder Date: Thu, 7 Jan 2021 16:18:44 +0000 Subject: [PATCH 3/3] code tidy up --- tests/SharedTests/TestMetadata.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/SharedTests/TestMetadata.cs b/tests/SharedTests/TestMetadata.cs index 949d9ed4..381466f8 100644 --- a/tests/SharedTests/TestMetadata.cs +++ b/tests/SharedTests/TestMetadata.cs @@ -230,7 +230,6 @@ public void RetrieveMetadataChangesRequest() var response = (RetrieveMetadataChangesResponse)orgAdminService.Execute(retrieveMetadataChangesRequest); Assert.Equal("account", response.EntityMetadata[0].LogicalName); - } }