public void BooleanType()
        {
            XrmFakedContext fakedContext = SupportMethods.SetupPrimitiveFakedService(
                SupportMethods.ThemeLogicalName,
                SupportMethods.ThemeDisplayName,
                SupportMethods.GetBooleanTypeEntity());
            IOrganizationService fakedService = fakedContext.GetOrganizationService();

            DataBuilder DataBuilder = new DataBuilder(fakedService);

            DataBuilder.AppendData(SupportMethods.GetBooleanTypeFetch_TopIsOne());
            Assert.AreEqual(
                DataBuilder.BuildDataXML().InnerXml,
                SupportMethods.GetBooleanTypeExpectedData());
        }
Example #2
0
        public void SingleEntity_MoreThan5000RecordsWithTopIsOne_ReturnsOne()
        {
            XrmFakedContext fakedContext = SupportMethods.SetupPrimitiveFakedService(
                SupportMethods.ThemeLogicalName,
                SupportMethods.ThemeDisplayName,
                SupportMethods.GetSingleEntity_MoreThan5000RowsEntity().ToArray());
            IOrganizationService fakedService = fakedContext.GetOrganizationService();

            DataBuilder DataBuilder = new DataBuilder(fakedService);

            DataBuilder.AppendData(SupportMethods.GetBooleanTypeFetch_TopIsOne());

            var innerXml = DataBuilder.BuildDataXML();

            Assert.IsTrue(innerXml.SelectSingleNode("//entities/entity/records").ChildNodes.Count == 1);
        }
Example #3
0
        public void BooleanType()
        {
            XrmFakedContext fakedContext = SupportMethods.SetupPrimitiveFakedService(
                SupportMethods.ThemeLogicalName,
                SupportMethods.ThemeDisplayName,
                SupportMethods.GetBooleanTypeEntity());

            fakedContext.AddExecutionMock <RetrieveEntityRequest>(req =>
            {
                var entityMetadata         = fakedContext.GetEntityMetadataByName(SupportMethods.ThemeLogicalName);
                entityMetadata.DisplayName = new Label(SupportMethods.ThemeDisplayName, 1033);
                entityMetadata.SetSealedPropertyValue("PrimaryNameAttribute", "name");

                entityMetadata.Attributes.First(a => a.LogicalName == "isdefaulttheme").SetSealedPropertyValue("DisplayName", new Label("Default Theme", 1033));
                entityMetadata.Attributes.First(a => a.LogicalName == "themeid").SetSealedPropertyValue("DisplayName", new Label("Theme", 1033));

                var response = new RetrieveEntityResponse()
                {
                    Results = new ParameterCollection
                    {
                        { "EntityMetadata", entityMetadata }
                    }
                };
                return(response);
            });

            IOrganizationService fakedService = fakedContext.GetOrganizationService();

            DataBuilder DataBuilder = new DataBuilder(fakedService);

            DataBuilder.AppendData(SupportMethods.GetBooleanTypeFetch_TopIsOne());

            String DataBuilderXML = DataBuilder.BuildSchemaXML().InnerXml;
            String RealXml        = SupportMethods.GetBooleanTypeExpectedSchema();

            Assert.AreEqual(
                DataBuilder.BuildSchemaXML().InnerXml,
                SupportMethods.GetBooleanTypeExpectedSchema());
        }