public void OwnerType() { // OwnerType ownerid knowledgearticle XrmFakedContext fakedContext = SupportMethods.SetupPrimitiveFakedService( SupportMethods.KnowledgeArticleLogicalName, SupportMethods.KnowledgeArticleDisplayName, SupportMethods.GetOwnerTypeEntity()); IOrganizationService fakedService = fakedContext.GetOrganizationService(); DataBuilder DataBuilder = new DataBuilder(fakedService); DataBuilder.AppendData(SupportMethods.GetOwnerTypeFetch()); Assert.AreEqual( DataBuilder.BuildDataXML().InnerXml, SupportMethods.GetOwnerTypeExpectedData()); }
public void OwnerType() { // OwnerType ownerid knowledgearticle XrmFakedContext fakedContext = SupportMethods.SetupPrimitiveFakedService( SupportMethods.KnowledgeArticleLogicalName, SupportMethods.KnowledgeArticleDisplayName, SupportMethods.GetOwnerTypeEntity()); fakedContext.AddExecutionMock <RetrieveEntityRequest>(req => { var entityMetadata = fakedContext.GetEntityMetadataByName(SupportMethods.KnowledgeArticleLogicalName); entityMetadata.DisplayName = new Label(SupportMethods.KnowledgeArticleDisplayName, 1033); entityMetadata.SetSealedPropertyValue("PrimaryNameAttribute", "title"); entityMetadata.Attributes.First(a => a.LogicalName == "ownerid").SetSealedPropertyValue("DisplayName", new Label("Owner", 1033)); entityMetadata.Attributes.First(a => a.LogicalName == "ownerid").SetSealedPropertyValue("AttributeType", Sdk.Metadata.AttributeTypeCode.Owner); entityMetadata.Attributes.First(a => a.LogicalName == "knowledgearticleid").SetSealedPropertyValue("DisplayName", new Label("Knowledge Article", 1033)); var response = new RetrieveEntityResponse() { Results = new ParameterCollection { { "EntityMetadata", entityMetadata } } }; return(response); }); IOrganizationService fakedService = fakedContext.GetOrganizationService(); DataBuilder DataBuilder = new DataBuilder(fakedService); DataBuilder.AppendData(SupportMethods.GetOwnerTypeFetch()); Assert.AreEqual( DataBuilder.BuildSchemaXML().InnerXml, SupportMethods.GetOwnerTypeExpectedSchema()); }