public void MemoType() { // MemoType keywords knowledgearticle XrmFakedContext fakedContext = SupportMethods.SetupPrimitiveFakedService( SupportMethods.KnowledgeArticleLogicalName, SupportMethods.KnowledgeArticleDisplayName, SupportMethods.GetMemoTypeEntity()); IOrganizationService fakedService = fakedContext.GetOrganizationService(); DataBuilder DataBuilder = new DataBuilder(fakedService); DataBuilder.AppendData(SupportMethods.GetMemoTypeFetch()); Assert.AreEqual( DataBuilder.BuildDataXML().InnerXml, SupportMethods.GetMemoTypeExpectedData()); }
public void MemoType() { // MemoType keywords knowledgearticle XrmFakedContext fakedContext = SupportMethods.SetupPrimitiveFakedService( SupportMethods.KnowledgeArticleLogicalName, SupportMethods.KnowledgeArticleDisplayName, SupportMethods.GetMemoTypeEntity()); 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 == "keywords").SetSealedPropertyValue("DisplayName", new Label("Keywords", 1033)); entityMetadata.Attributes.First(a => a.LogicalName == "keywords").SetSealedPropertyValue("AttributeType", Sdk.Metadata.AttributeTypeCode.Memo); 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.GetMemoTypeFetch()); Assert.AreEqual( DataBuilder.BuildSchemaXML().InnerXml, SupportMethods.GetMemoTypeExpectedSchema()); }