public void RemoveEntityWithNonExistentField_RemovesNothing() { DataBuilder db = new DataBuilder(); db.AppendData(SupportMethods.GetIntegerTypeExpectedData(), SupportMethods.GetIntegerTypeExpectedSchema()); db.RemoveData(SupportMethods.GetLookupTypeEntity()); Assert.AreEqual( db.BuildDataXML().InnerXml, SupportMethods.GetIntegerTypeExpectedData()); }
public void ReflexiveRelationship_Data() { // LookupType previousarticlecontentid knowledgearticle XrmFakedContext fakedContext = SupportMethods.SetupPrimitiveFakedService( SupportMethods.KnowledgeArticleLogicalName, SupportMethods.KnowledgeArticleDisplayName, SupportMethods.GetLookupTypeEntity()); IOrganizationService fakedService = fakedContext.GetOrganizationService(); DataBuilder DataBuilder = new DataBuilder(fakedService); DataBuilder.AppendData(SupportMethods.GetLookupTypeFetch()); Assert.IsTrue(DataBuilder.BuildDataXML().SelectSingleNode("entities/entity[@name='knowledgearticle']/records/record[@id='" + ((EntityReference)SupportMethods.GetLookupTypeEntity()["previousarticlecontentid"]).Id.ToString() + "']") != null); }
public void LookupType() { // LookupType previousarticlecontentid knowledgearticle XrmFakedContext fakedContext = SupportMethods.SetupPrimitiveFakedService( SupportMethods.KnowledgeArticleLogicalName, SupportMethods.KnowledgeArticleDisplayName, SupportMethods.GetLookupTypeEntity()); IOrganizationService fakedService = fakedContext.GetOrganizationService(); DataBuilder DataBuilder = new DataBuilder(fakedService); DataBuilder.AppendData(SupportMethods.GetLookupTypeFetch()); Assert.AreEqual( DataBuilder.BuildDataXML().InnerXml, SupportMethods.GetLookupTypeExpectedData()); }
public void LookupType() { // LookupType previousarticlecontentid knowledgearticle XrmFakedContext fakedContext = SupportMethods.SetupPrimitiveFakedService( SupportMethods.KnowledgeArticleLogicalName, SupportMethods.KnowledgeArticleDisplayName, SupportMethods.GetLookupTypeEntity()); 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 == "previousarticlecontentid").SetSealedPropertyValue("DisplayName", new Label("Previous Article Content ID", 1033)); entityMetadata.Attributes.First(a => a.LogicalName == "previousarticlecontentid").SetSealedPropertyValue("Targets", new String[] { "knowledgearticle" }); 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.GetLookupTypeFetch()); Assert.AreEqual( DataBuilder.BuildSchemaXML().InnerXml, SupportMethods.GetLookupTypeExpectedSchema()); }