public void DateTimeType() { // DateTimeType publishon knowledgearticle XrmFakedContext fakedContext = SupportMethods.SetupPrimitiveFakedService( SupportMethods.KnowledgeArticleLogicalName, SupportMethods.KnowledgeArticleDisplayName, SupportMethods.GetDateTimeTypeEntity()); IOrganizationService fakedService = fakedContext.GetOrganizationService(); DataBuilder DataBuilder = new DataBuilder(fakedService); DataBuilder.AppendData(SupportMethods.GetDateTimeTypeFetch()); Assert.AreEqual( DataBuilder.BuildDataXML().InnerXml, SupportMethods.GetDateTimeTypeExpectedData()); }
public void DateTimeType() { // DateTimeType publishon knowledgearticle XrmFakedContext fakedContext = SupportMethods.SetupPrimitiveFakedService( SupportMethods.KnowledgeArticleLogicalName, SupportMethods.KnowledgeArticleDisplayName, SupportMethods.GetDateTimeTypeEntity()); 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 == "publishon").SetSealedPropertyValue("DisplayName", new Label("Publish On", 1033)); 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.GetDateTimeTypeFetch()); Assert.AreEqual( DataBuilder.BuildSchemaXML().InnerXml, SupportMethods.GetDateTimeTypeExpectedSchema()); }