public void MultiValueIdentifierSchema() { var fakedContext = new XrmFakedContext(); fakedContext.InitializeMetadata(typeof(CrmEarlyBound.CrmServiceContext).Assembly); fakedContext.Initialize(SupportMethods.GetMultiValueIdentifierEntity()); fakedContext.AddExecutionMock <RetrieveEntityRequest>(req => { var entityMetadata = fakedContext.GetEntityMetadataByName(SupportMethods.ContactLogicalName); entityMetadata.DisplayName = new Label(SupportMethods.ContactDisplayName, 1033); entityMetadata.SetSealedPropertyValue("PrimaryNameAttribute", "fullname"); entityMetadata.Attributes.First(a => a.LogicalName == "firstname").SetSealedPropertyValue("DisplayName", new Label("First Name", 1033)); entityMetadata.Attributes.First(a => a.LogicalName == "fullname").SetSealedPropertyValue("DisplayName", new Label("Full Name", 1033)); entityMetadata.Attributes.First(a => a.LogicalName == "lastname").SetSealedPropertyValue("DisplayName", new Label("Last Name", 1033)); entityMetadata.Attributes.First(a => a.LogicalName == "birthdate").SetSealedPropertyValue("DisplayName", new Label("Birthday", 1033)); entityMetadata.Attributes.First(a => a.LogicalName == "emailaddress1").SetSealedPropertyValue("DisplayName", new Label("Email", 1033)); entityMetadata.Attributes.First(a => a.LogicalName == "contactid").SetSealedPropertyValue("DisplayName", new Label("Contact", 1033)); var response = new RetrieveEntityResponse() { Results = new ParameterCollection { { "EntityMetadata", entityMetadata } } }; return(response); }); IOrganizationService fakedService = fakedContext.GetOrganizationService(); DataBuilder DataBuilder = new DataBuilder(fakedService); DataBuilder.AppendData(SupportMethods.GetMultiValueIdentifierFetch()); DataBuilder.SetIdentifier(SupportMethods.ContactLogicalName, new String[] { "firstname", "lastname", "birthdate" }); Assert.AreEqual( DataBuilder.BuildSchemaXML().InnerXml, SupportMethods.GetMultiValueIdentifierEntityExpectedSchema()); }