예제 #1
0
        public async Task TestPolymorphismWithAttributeGroupRef()
        {
            bool   updateResults = false;
            string testName      = "TestPolymorphismWithAttributeGroupRef";
            {
                string entityName = "Customer";

                // Refer to bug https://powerbi.visualstudio.com/Power%20Query/_workitems/edit/327155
                AttributeContextExpectedValue expectedContext_default                             = null;
                AttributeContextExpectedValue expectedContext_normalized                          = null;
                AttributeContextExpectedValue expectedContext_referenceOnly                       = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_structured                          = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_normalized_structured               = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_normalized            = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_structured            = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_normalized_structured = new AttributeContextExpectedValue();

                // Refer to bug https://powerbi.visualstudio.com/Power%20Query/_workitems/edit/327155
                List <AttributeExpectedValue> expected_default                             = null;
                List <AttributeExpectedValue> expected_normalized                          = null;
                List <AttributeExpectedValue> expected_referenceOnly                       = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_structured                          = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_normalized_structured               = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_normalized            = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_structured            = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_normalized_structured = new List <AttributeExpectedValue>();

                await RunTestWithValues(
                    testName,
                    entityName,

                    expectedContext_default,
                    expectedContext_normalized,
                    expectedContext_referenceOnly,
                    expectedContext_structured,
                    expectedContext_normalized_structured,
                    expectedContext_referenceOnly_normalized,
                    expectedContext_referenceOnly_structured,
                    expectedContext_referenceOnly_normalized_structured,

                    expected_default,
                    expected_normalized,
                    expected_referenceOnly,
                    expected_structured,
                    expected_normalized_structured,
                    expected_referenceOnly_normalized,
                    expected_referenceOnly_structured,
                    expected_referenceOnly_normalized_structured,
                    updateResults
                    );
            }
        }
        public async Task TestExpansionAndRenamedOrdinal23AndAddCount()
        {
            bool   updateResults = false;
            string testName      = "TestExpansionAndRenamedOrdinal23AndAddCount";
            {
                string entityName = "EmployeeAddresses";

                AttributeContextExpectedValue expectedContext_default                             = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_normalized                          = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly                       = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_structured                          = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_normalized_structured               = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_normalized            = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_structured            = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_normalized_structured = new AttributeContextExpectedValue();

                List <AttributeExpectedValue> expected_default                             = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_normalized                          = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly                       = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_structured                          = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_normalized_structured               = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_normalized            = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_structured            = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_normalized_structured = new List <AttributeExpectedValue>();

                await RunTestWithValues(
                    testName,
                    entityName,

                    expectedContext_default,
                    expectedContext_normalized,
                    expectedContext_referenceOnly,
                    expectedContext_structured,
                    expectedContext_normalized_structured,
                    expectedContext_referenceOnly_normalized,
                    expectedContext_referenceOnly_structured,
                    expectedContext_referenceOnly_normalized_structured,

                    expected_default,
                    expected_normalized,
                    expected_referenceOnly,
                    expected_structured,
                    expected_normalized_structured,
                    expected_referenceOnly_normalized,
                    expected_referenceOnly_structured,
                    expected_referenceOnly_normalized_structured,
                    updateResults
                    );
            }
        }
예제 #3
0
        public async Task TestAddInSupportOfWithIsCorrelatedWith()
        {
            bool   updateResults = false;
            string testName      = nameof(TestAddInSupportOfWithIsCorrelatedWith);
            {
                string entityName = "Product";

                AttributeContextExpectedValue expectedContext_default                             = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_normalized                          = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly                       = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_structured                          = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_normalized_structured               = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_normalized            = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_structured            = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_normalized_structured = new AttributeContextExpectedValue();

                List <AttributeExpectedValue> expected_default                             = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_normalized                          = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly                       = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_structured                          = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_normalized_structured               = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_normalized            = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_structured            = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_normalized_structured = new List <AttributeExpectedValue>();

                await RunTestWithValues(
                    testName,
                    entityName,

                    expectedContext_default,
                    expectedContext_normalized,
                    expectedContext_referenceOnly,
                    expectedContext_structured,
                    expectedContext_normalized_structured,
                    expectedContext_referenceOnly_normalized,
                    expectedContext_referenceOnly_structured,
                    expectedContext_referenceOnly_normalized_structured,

                    expected_default,
                    expected_normalized,
                    expected_referenceOnly,
                    expected_structured,
                    expected_normalized_structured,
                    expected_referenceOnly_normalized,
                    expected_referenceOnly_structured,
                    expected_referenceOnly_normalized_structured,
                    updateResults
                    );
            }
        }
        public async Task TestAddInSupportOf()
        {
            string testName = "TestAddInSupportOf";
            {
                string entityName = "Product";

                AttributeContextExpectedValue expectedContext_default                             = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_normalized                          = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly                       = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_structured                          = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_normalized_structured               = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_normalized            = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_structured            = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_normalized_structured = new AttributeContextExpectedValue();

                List <AttributeExpectedValue> expected_default                             = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_normalized                          = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly                       = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_structured                          = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_normalized_structured               = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_normalized            = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_structured            = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_normalized_structured = new List <AttributeExpectedValue>();

                await RunTestWithValues(
                    testName,
                    entityName,

                    expectedContext_default,
                    expectedContext_normalized,
                    expectedContext_referenceOnly,
                    expectedContext_structured,
                    expectedContext_normalized_structured,
                    expectedContext_referenceOnly_normalized,
                    expectedContext_referenceOnly_structured,
                    expectedContext_referenceOnly_normalized_structured,

                    expected_default,
                    expected_normalized,
                    expected_referenceOnly,
                    expected_structured,
                    expected_normalized_structured,
                    expected_referenceOnly_normalized,
                    expected_referenceOnly_structured,
                    expected_referenceOnly_normalized_structured
                    );
            }
        }
        public async Task TestExpansionAndRenamedOrdinalWithAttributeGroupRef()
        {
            string testName = "TestExpansionAndRenamedOrdinalWithAttributeGroupRef";
            {
                string entityName = "EmployeeAddresses";

                AttributeContextExpectedValue expectedContext_default                             = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_normalized                          = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly                       = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_structured                          = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_normalized_structured               = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_normalized            = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_structured            = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_normalized_structured = new AttributeContextExpectedValue();

                List <AttributeExpectedValue> expected_default                             = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_normalized                          = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly                       = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_structured                          = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_normalized_structured               = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_normalized            = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_structured            = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_normalized_structured = new List <AttributeExpectedValue>();

                await RunTestWithValues(
                    testName,
                    entityName,

                    expectedContext_default,
                    expectedContext_normalized,
                    expectedContext_referenceOnly,
                    expectedContext_structured,
                    expectedContext_normalized_structured,
                    expectedContext_referenceOnly_normalized,
                    expectedContext_referenceOnly_structured,
                    expectedContext_referenceOnly_normalized_structured,

                    expected_default,
                    expected_normalized,
                    expected_referenceOnly,
                    expected_structured,
                    expected_normalized_structured,
                    expected_referenceOnly_normalized,
                    expected_referenceOnly_structured,
                    expected_referenceOnly_normalized_structured
                    );
            }
        }
예제 #6
0
        public async Task TestForeignKeyOneToManyCardinality()
        {
            string testName = "TestForeignKeyOneToManyCardinality";
            {
                string entityName = "Team";

                AttributeContextExpectedValue expectedContext_default                             = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_normalized                          = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly                       = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_structured                          = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_normalized_structured               = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_normalized            = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_structured            = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_normalized_structured = new AttributeContextExpectedValue();

                List <AttributeExpectedValue> expected_default                             = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_normalized                          = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly                       = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_structured                          = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_normalized_structured               = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_normalized            = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_structured            = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_normalized_structured = new List <AttributeExpectedValue>();

                await RunTestWithValues(
                    testName,
                    entityName,

                    expectedContext_default,
                    expectedContext_normalized,
                    expectedContext_referenceOnly,
                    expectedContext_structured,
                    expectedContext_normalized_structured,
                    expectedContext_referenceOnly_normalized,
                    expectedContext_referenceOnly_structured,
                    expectedContext_referenceOnly_normalized_structured,

                    expected_default,
                    expected_normalized,
                    expected_referenceOnly,
                    expected_structured,
                    expected_normalized_structured,
                    expected_referenceOnly_normalized,
                    expected_referenceOnly_structured,
                    expected_referenceOnly_normalized_structured
                    );
            }
            {
                string entityName = "Employee";

                AttributeContextExpectedValue expectedContext_default                             = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_normalized                          = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly                       = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_structured                          = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_normalized_structured               = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_normalized            = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_structured            = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_normalized_structured = new AttributeContextExpectedValue();

                List <AttributeExpectedValue> expected_default = new List <AttributeExpectedValue>();
                {
                    expected_default.Add(new AttributeExpectedValue()
                    {
                        AttributeContext = "Employee_Resolved_default/attributeContext/Employee_Resolved_default/attributesAddedAtThisScope/attributesAddedAtThisScope/ID",
                        DataFormat       = "Guid",
                        DisplayName      = "ID",
                        IsPrimaryKey     = true,
                        Name             = "ID",
                        SourceName       = "ID",
                    });
                    expected_default.Add(new AttributeExpectedValue()
                    {
                        AttributeContext = "Employee_Resolved_default/attributeContext/Employee_Resolved_default/attributesAddedAtThisScope/attributesAddedAtThisScope/FullName",
                        DataFormat       = "String",
                        DisplayName      = "FullName",
                        Name             = "FullName",
                        SourceName       = "FullName",
                    });
                    expected_default.Add(new AttributeExpectedValue()
                    {
                        AttributeContext = "Employee_Resolved_default/attributeContext/Employee_Resolved_default/attributesAddedAtThisScope/attributesAddedAtThisScope/TeamID/_generatedAttributeSet/TeamIDTeamCount",
                        DataFormat       = "Int32",
                        Name             = "TeamIDTeamCount",
                    });
                }
                List <AttributeExpectedValue> expected_normalized = new List <AttributeExpectedValue>();
                {
                    expected_normalized.Add(new AttributeExpectedValue()
                    {
                        AttributeContext = "Employee_Resolved_normalized/attributeContext/Employee_Resolved_normalized/attributesAddedAtThisScope/attributesAddedAtThisScope/ID",
                        DataFormat       = "Guid",
                        DisplayName      = "ID",
                        IsPrimaryKey     = true,
                        Name             = "ID",
                        SourceName       = "ID",
                    });
                    expected_normalized.Add(new AttributeExpectedValue()
                    {
                        AttributeContext = "Employee_Resolved_normalized/attributeContext/Employee_Resolved_normalized/attributesAddedAtThisScope/attributesAddedAtThisScope/FullName",
                        DataFormat       = "String",
                        DisplayName      = "FullName",
                        Name             = "FullName",
                        SourceName       = "FullName",
                    });
                }
                List <AttributeExpectedValue> expected_referenceOnly = new List <AttributeExpectedValue>();
                {
                    expected_referenceOnly.Add(new AttributeExpectedValue()
                    {
                        AttributeContext = "Employee_Resolved_referenceOnly/attributeContext/Employee_Resolved_referenceOnly/attributesAddedAtThisScope/attributesAddedAtThisScope/ID",
                        DataFormat       = "Guid",
                        DisplayName      = "ID",
                        IsPrimaryKey     = true,
                        Name             = "ID",
                        SourceName       = "ID",
                    });
                    expected_referenceOnly.Add(new AttributeExpectedValue()
                    {
                        AttributeContext = "Employee_Resolved_referenceOnly/attributeContext/Employee_Resolved_referenceOnly/attributesAddedAtThisScope/attributesAddedAtThisScope/FullName",
                        DataFormat       = "String",
                        DisplayName      = "FullName",
                        Name             = "FullName",
                        SourceName       = "FullName",
                    });
                    expected_referenceOnly.Add(new AttributeExpectedValue()
                    {
                        AttributeContext = "Employee_Resolved_referenceOnly/attributeContext/Employee_Resolved_referenceOnly/attributesAddedAtThisScope/attributesAddedAtThisScope/TeamID/_generatedAttributeSet/TeamIDTeamCount",
                        DataFormat       = "Int32",
                        Name             = "TeamIDTeamCount",
                    });
                }
                List <AttributeExpectedValue> expected_structured = new List <AttributeExpectedValue>();
                {
                    expected_structured.Add(new AttributeExpectedValue()
                    {
                        AttributeContext = "Employee_Resolved_structured/attributeContext/Employee_Resolved_structured/attributesAddedAtThisScope/attributesAddedAtThisScope/ID",
                        DataFormat       = "Guid",
                        DisplayName      = "ID",
                        IsPrimaryKey     = true,
                        Name             = "ID",
                        SourceName       = "ID",
                    });
                    expected_structured.Add(new AttributeExpectedValue()
                    {
                        AttributeContext = "Employee_Resolved_structured/attributeContext/Employee_Resolved_structured/attributesAddedAtThisScope/attributesAddedAtThisScope/FullName",
                        DataFormat       = "String",
                        DisplayName      = "FullName",
                        Name             = "FullName",
                        SourceName       = "FullName",
                    });
                    AttributeExpectedValue AttribGroupRef = new AttributeExpectedValue();
                    {
                        AttribGroupRef.AttributeGroupName = "TeamID";
                        AttribGroupRef.AttributeContext   = "Employee_Resolved_structured/attributeContext/Employee_Resolved_structured/attributesAddedAtThisScope/attributesAddedAtThisScope/TeamID";
                        AttribGroupRef.Members            = new List <AttributeExpectedValue>();
                        AttribGroupRef.Members.Add(new AttributeExpectedValue()
                        {
                            AttributeContext = "Employee_Resolved_structured/attributeContext/Employee_Resolved_structured/attributesAddedAtThisScope/attributesAddedAtThisScope/TeamID/Team/attributesAddedAtThisScope/attributesAddedAtThisScope/ID",
                            DataFormat       = "Guid",
                            Name             = "ID",
                        });
                        AttribGroupRef.Members.Add(new AttributeExpectedValue()
                        {
                            AttributeContext = "Employee_Resolved_structured/attributeContext/Employee_Resolved_structured/attributesAddedAtThisScope/attributesAddedAtThisScope/TeamID/Team/attributesAddedAtThisScope/attributesAddedAtThisScope/Name",
                            DataFormat       = "String",
                            Name             = "Name",
                        });
                        expected_structured.Add(AttribGroupRef);
                    };
                }
                List <AttributeExpectedValue> expected_normalized_structured = new List <AttributeExpectedValue>();
                {
                    expected_normalized_structured.Add(new AttributeExpectedValue()
                    {
                        AttributeContext = "Employee_Resolved_normalized_structured/attributeContext/Employee_Resolved_normalized_structured/attributesAddedAtThisScope/attributesAddedAtThisScope/ID",
                        DataFormat       = "Guid",
                        DisplayName      = "ID",
                        IsPrimaryKey     = true,
                        Name             = "ID",
                        SourceName       = "ID",
                    });
                    expected_normalized_structured.Add(new AttributeExpectedValue()
                    {
                        AttributeContext = "Employee_Resolved_normalized_structured/attributeContext/Employee_Resolved_normalized_structured/attributesAddedAtThisScope/attributesAddedAtThisScope/FullName",
                        DataFormat       = "String",
                        DisplayName      = "FullName",
                        Name             = "FullName",
                        SourceName       = "FullName",
                    });
                }
                List <AttributeExpectedValue> expected_referenceOnly_normalized = new List <AttributeExpectedValue>();
                {
                    expected_referenceOnly_normalized.Add(new AttributeExpectedValue()
                    {
                        AttributeContext = "Employee_Resolved_referenceOnly_normalized/attributeContext/Employee_Resolved_referenceOnly_normalized/attributesAddedAtThisScope/attributesAddedAtThisScope/ID",
                        DataFormat       = "Guid",
                        DisplayName      = "ID",
                        IsPrimaryKey     = true,
                        Name             = "ID",
                        SourceName       = "ID",
                    });
                    expected_referenceOnly_normalized.Add(new AttributeExpectedValue()
                    {
                        AttributeContext = "Employee_Resolved_referenceOnly_normalized/attributeContext/Employee_Resolved_referenceOnly_normalized/attributesAddedAtThisScope/attributesAddedAtThisScope/FullName",
                        DataFormat       = "String",
                        DisplayName      = "FullName",
                        Name             = "FullName",
                        SourceName       = "FullName",
                    });
                }
                List <AttributeExpectedValue> expected_referenceOnly_structured = new List <AttributeExpectedValue>();
                {
                    expected_referenceOnly_structured.Add(new AttributeExpectedValue()
                    {
                        AttributeContext = "Employee_Resolved_referenceOnly_structured/attributeContext/Employee_Resolved_referenceOnly_structured/attributesAddedAtThisScope/attributesAddedAtThisScope/ID",
                        DataFormat       = "Guid",
                        DisplayName      = "ID",
                        IsPrimaryKey     = true,
                        Name             = "ID",
                        SourceName       = "ID",
                    });
                    expected_referenceOnly_structured.Add(new AttributeExpectedValue()
                    {
                        AttributeContext = "Employee_Resolved_referenceOnly_structured/attributeContext/Employee_Resolved_referenceOnly_structured/attributesAddedAtThisScope/attributesAddedAtThisScope/FullName",
                        DataFormat       = "String",
                        DisplayName      = "FullName",
                        Name             = "FullName",
                        SourceName       = "FullName",
                    });
                    AttributeExpectedValue AttribGroupRef = new AttributeExpectedValue();
                    {
                        AttribGroupRef.AttributeGroupName = "TeamID";
                        AttribGroupRef.AttributeContext   = "Employee_Resolved_referenceOnly_structured/attributeContext/Employee_Resolved_referenceOnly_structured/attributesAddedAtThisScope/attributesAddedAtThisScope/TeamID";
                        AttribGroupRef.Members            = new List <AttributeExpectedValue>();
                        AttribGroupRef.Members.Add(new AttributeExpectedValue()
                        {
                            AttributeContext = "Employee_Resolved_referenceOnly_structured/attributeContext/Employee_Resolved_referenceOnly_structured/attributesAddedAtThisScope/attributesAddedAtThisScope/TeamID/_generatedAttributeSet/_generatedAttributeRound0/_foreignKey",
                            DataFormat       = "Guid",
                            Description      = "",
                            DisplayName      = "TeamID",
                            Name             = "TeamID",
                            SourceName       = "TeamID",
                        });
                        expected_referenceOnly_structured.Add(AttribGroupRef);
                    };
                }
                List <AttributeExpectedValue> expected_referenceOnly_normalized_structured = new List <AttributeExpectedValue>();
                {
                    expected_referenceOnly_normalized_structured.Add(new AttributeExpectedValue()
                    {
                        AttributeContext = "Employee_Resolved_referenceOnly_normalized_structured/attributeContext/Employee_Resolved_referenceOnly_normalized_structured/attributesAddedAtThisScope/attributesAddedAtThisScope/ID",
                        DataFormat       = "Guid",
                        DisplayName      = "ID",
                        IsPrimaryKey     = true,
                        Name             = "ID",
                        SourceName       = "ID",
                    });
                    expected_referenceOnly_normalized_structured.Add(new AttributeExpectedValue()
                    {
                        AttributeContext = "Employee_Resolved_referenceOnly_normalized_structured/attributeContext/Employee_Resolved_referenceOnly_normalized_structured/attributesAddedAtThisScope/attributesAddedAtThisScope/FullName",
                        DataFormat       = "String",
                        DisplayName      = "FullName",
                        Name             = "FullName",
                        SourceName       = "FullName",
                    });
                }

                await RunTestWithValues(
                    testName,
                    entityName,

                    expectedContext_default,
                    expectedContext_normalized,
                    expectedContext_referenceOnly,
                    expectedContext_structured,
                    expectedContext_normalized_structured,
                    expectedContext_referenceOnly_normalized,
                    expectedContext_referenceOnly_structured,
                    expectedContext_referenceOnly_normalized_structured,

                    expected_default,
                    expected_normalized,
                    expected_referenceOnly,
                    expected_structured,
                    expected_normalized_structured,
                    expected_referenceOnly_normalized,
                    expected_referenceOnly_structured,
                    expected_referenceOnly_normalized_structured
                    );
            }
        }
예제 #7
0
        public async Task TestForeignKeyOneToOneCardinality()
        {
            string testName = "TestForeignKeyOneToOneCardinality";
            {
                string entityName = "Person";

                AttributeContextExpectedValue expectedContext_default                             = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_normalized                          = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly                       = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_structured                          = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_normalized_structured               = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_normalized            = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_structured            = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_normalized_structured = new AttributeContextExpectedValue();

                List <AttributeExpectedValue> expected_default                             = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_normalized                          = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly                       = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_structured                          = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_normalized_structured               = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_normalized            = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_structured            = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_normalized_structured = new List <AttributeExpectedValue>();

                await RunTestWithValues(
                    testName,
                    entityName,

                    expectedContext_default,
                    expectedContext_normalized,
                    expectedContext_referenceOnly,
                    expectedContext_structured,
                    expectedContext_normalized_structured,
                    expectedContext_referenceOnly_normalized,
                    expectedContext_referenceOnly_structured,
                    expectedContext_referenceOnly_normalized_structured,

                    expected_default,
                    expected_normalized,
                    expected_referenceOnly,
                    expected_structured,
                    expected_normalized_structured,
                    expected_referenceOnly_normalized,
                    expected_referenceOnly_structured,
                    expected_referenceOnly_normalized_structured
                    );
            }
            {
                string entityName = "PersonContact";

                AttributeContextExpectedValue expectedContext_default                             = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_normalized                          = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly                       = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_structured                          = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_normalized_structured               = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_normalized            = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_structured            = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_normalized_structured = new AttributeContextExpectedValue();

                List <AttributeExpectedValue> expected_default                             = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_normalized                          = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly                       = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_structured                          = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_normalized_structured               = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_normalized            = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_structured            = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_normalized_structured = new List <AttributeExpectedValue>();

                await RunTestWithValues(
                    testName,
                    entityName,

                    expectedContext_default,
                    expectedContext_normalized,
                    expectedContext_referenceOnly,
                    expectedContext_structured,
                    expectedContext_normalized_structured,
                    expectedContext_referenceOnly_normalized,
                    expectedContext_referenceOnly_structured,
                    expectedContext_referenceOnly_normalized_structured,

                    expected_default,
                    expected_normalized,
                    expected_referenceOnly,
                    expected_structured,
                    expected_normalized_structured,
                    expected_referenceOnly_normalized,
                    expected_referenceOnly_structured,
                    expected_referenceOnly_normalized_structured
                    );
            }
        }
예제 #8
0
        /// <summary>
        /// This method runs the tests with a set expected attributes & attribute context values and validated the actual result
        /// </summary>
        /// <param name="testName"></param>
        /// <param name="sourceEntityName"></param>
        /// <param name="expectedContext_*">expected attribute context object - for each resolution option combination</param>
        /// <param name="expected_*">expected attribute object - for each resolution option combination</param>
        /// <returns></returns>
        protected static async Task RunTestWithValues(
            string testName,
            string sourceEntityName,

            AttributeContextExpectedValue expectedContext_default,
            AttributeContextExpectedValue expectedContext_normalized,
            AttributeContextExpectedValue expectedContext_referenceOnly,
            AttributeContextExpectedValue expectedContext_structured,
            AttributeContextExpectedValue expectedContext_normalized_structured,
            AttributeContextExpectedValue expectedContext_referenceOnly_normalized,
            AttributeContextExpectedValue expectedContext_referenceOnly_structured,
            AttributeContextExpectedValue expectedContext_referenceOnly_normalized_structured,

            List <AttributeExpectedValue> expected_default,
            List <AttributeExpectedValue> expected_normalized,
            List <AttributeExpectedValue> expected_referenceOnly,
            List <AttributeExpectedValue> expected_structured,
            List <AttributeExpectedValue> expected_normalized_structured,
            List <AttributeExpectedValue> expected_referenceOnly_normalized,
            List <AttributeExpectedValue> expected_referenceOnly_structured,
            List <AttributeExpectedValue> expected_referenceOnly_normalized_structured
            )
        {
            try
            {
                string testInputPath    = TestHelper.GetInputFolderPath(TestsSubpath, testName);
                string testActualPath   = TestHelper.GetActualOutputFolderPath(TestsSubpath, testName);
                string testExpectedPath = TestHelper.GetExpectedOutputFolderPath(TestsSubpath, testName);
                string corpusPath       = testInputPath.Substring(0, testInputPath.Length - "/Input".Length);
                testActualPath = Path.GetFullPath(testActualPath);

                CdmCorpusDefinition corpus = new CdmCorpusDefinition();
                corpus.SetEventCallback(new EventCallback {
                    Invoke = CommonDataModelLoader.ConsoleStatusReport
                }, CdmStatusLevel.Warning);
                corpus.Storage.Mount("local", new LocalAdapter(corpusPath));
                corpus.Storage.Mount("cdm", new LocalAdapter(SchemaDocsPath));
                corpus.Storage.DefaultNamespace = "local";

                string outFolderPath          = corpus.Storage.AdapterPathToCorpusPath(testActualPath) + "/"; // interesting 'bug'
                CdmFolderDefinition outFolder = await corpus.FetchObjectAsync <CdmFolderDefinition>(outFolderPath);

                CdmEntityDefinition srcEntityDef = await corpus.FetchObjectAsync <CdmEntityDefinition>($"local:/Input/{sourceEntityName}.cdm.json/{sourceEntityName}");

                Assert.IsTrue(srcEntityDef != null);

                var resOpt = new ResolveOptions
                {
                    WrtDoc     = srcEntityDef.InDocument,
                    Directives = new AttributeResolutionDirectiveSet(new HashSet <string> {
                    })
                };

                CdmEntityDefinition resolvedEntityDef = null;
                string outputEntityName     = string.Empty;
                string outputEntityFileName = string.Empty;
                string entityFileName       = string.Empty;


                if (expectedContext_default != null && expected_default != null)
                {
                    entityFileName       = "d";
                    resOpt.Directives    = new AttributeResolutionDirectiveSet(new HashSet <string> {
                    });
                    outputEntityName     = $"{sourceEntityName}_R_{entityFileName}";
                    outputEntityFileName = $"{outputEntityName}.cdm.json";
                    resolvedEntityDef    = await srcEntityDef.CreateResolvedEntityAsync(outputEntityName, resOpt, outFolder);
                    await SaveActualEntityAndValidateWithExpected(Path.Combine(testExpectedPath, outputEntityFileName), resolvedEntityDef);
                }

                if (expectedContext_normalized != null && expected_normalized != null)
                {
                    entityFileName    = "n";
                    resOpt.Directives = new AttributeResolutionDirectiveSet(new HashSet <string> {
                        "normalized"
                    });
                    outputEntityName     = $"{sourceEntityName}_R_{entityFileName}";
                    outputEntityFileName = $"{outputEntityName}.cdm.json";
                    resolvedEntityDef    = await srcEntityDef.CreateResolvedEntityAsync(outputEntityName, resOpt, outFolder);
                    await SaveActualEntityAndValidateWithExpected(Path.Combine(testExpectedPath, outputEntityFileName), resolvedEntityDef);
                }

                if (expectedContext_referenceOnly != null && expected_referenceOnly != null)
                {
                    entityFileName    = "ro";
                    resOpt.Directives = new AttributeResolutionDirectiveSet(new HashSet <string> {
                        "referenceOnly"
                    });
                    outputEntityName     = $"{sourceEntityName}_R_{entityFileName}";
                    outputEntityFileName = $"{outputEntityName}.cdm.json";
                    resolvedEntityDef    = await srcEntityDef.CreateResolvedEntityAsync(outputEntityName, resOpt, outFolder);
                    await SaveActualEntityAndValidateWithExpected(Path.Combine(testExpectedPath, outputEntityFileName), resolvedEntityDef);
                }

                if (expectedContext_structured != null && expected_structured != null)
                {
                    entityFileName    = "s";
                    resOpt.Directives = new AttributeResolutionDirectiveSet(new HashSet <string> {
                        "structured"
                    });
                    outputEntityName     = $"{sourceEntityName}_R_{entityFileName}";
                    outputEntityFileName = $"{outputEntityName}.cdm.json";
                    resolvedEntityDef    = await srcEntityDef.CreateResolvedEntityAsync(outputEntityName, resOpt, outFolder);
                    await SaveActualEntityAndValidateWithExpected(Path.Combine(testExpectedPath, outputEntityFileName), resolvedEntityDef);
                }

                if (expectedContext_normalized_structured != null && expected_normalized_structured != null)
                {
                    entityFileName    = "n_s";
                    resOpt.Directives = new AttributeResolutionDirectiveSet(new HashSet <string> {
                        "normalized", "structured"
                    });
                    outputEntityName     = $"{sourceEntityName}_R_{entityFileName}";
                    outputEntityFileName = $"{outputEntityName}.cdm.json";
                    resolvedEntityDef    = await srcEntityDef.CreateResolvedEntityAsync(outputEntityName, resOpt, outFolder);
                    await SaveActualEntityAndValidateWithExpected(Path.Combine(testExpectedPath, outputEntityFileName), resolvedEntityDef);
                }

                if (expectedContext_referenceOnly_normalized != null && expected_referenceOnly_normalized != null)
                {
                    entityFileName    = "ro_n";
                    resOpt.Directives = new AttributeResolutionDirectiveSet(new HashSet <string> {
                        "referenceOnly", "normalized"
                    });
                    outputEntityName     = $"{sourceEntityName}_R_{entityFileName}";
                    outputEntityFileName = $"{outputEntityName}.cdm.json";
                    resolvedEntityDef    = await srcEntityDef.CreateResolvedEntityAsync(outputEntityName, resOpt, outFolder);
                    await SaveActualEntityAndValidateWithExpected(Path.Combine(testExpectedPath, outputEntityFileName), resolvedEntityDef);
                }

                if (expectedContext_referenceOnly_structured != null && expected_referenceOnly_structured != null)
                {
                    entityFileName    = "ro_s";
                    resOpt.Directives = new AttributeResolutionDirectiveSet(new HashSet <string> {
                        "referenceOnly", "structured"
                    });
                    outputEntityName     = $"{sourceEntityName}_R_{entityFileName}";
                    outputEntityFileName = $"{outputEntityName}.cdm.json";
                    resolvedEntityDef    = await srcEntityDef.CreateResolvedEntityAsync(outputEntityName, resOpt, outFolder);
                    await SaveActualEntityAndValidateWithExpected(Path.Combine(testExpectedPath, outputEntityFileName), resolvedEntityDef);
                }

                if (expectedContext_referenceOnly_normalized_structured != null && expected_referenceOnly_normalized_structured != null)
                {
                    entityFileName    = "ro_n_s";
                    resOpt.Directives = new AttributeResolutionDirectiveSet(new HashSet <string> {
                        "referenceOnly", "normalized", "structured"
                    });
                    outputEntityName     = $"{sourceEntityName}_R_{entityFileName}";
                    outputEntityFileName = $"{outputEntityName}.cdm.json";
                    resolvedEntityDef    = await srcEntityDef.CreateResolvedEntityAsync(outputEntityName, resOpt, outFolder);
                    await SaveActualEntityAndValidateWithExpected(Path.Combine(testExpectedPath, outputEntityFileName), resolvedEntityDef);
                }
            }
            catch (Exception e)
            {
                Assert.Fail(e.Message);
            }
        }
        /// <summary>
        /// This method runs the tests with a set expected attributes & attribute context values and validated the actual result
        /// </summary>
        /// <param name="testName"></param>
        /// <param name="sourceEntityName"></param>
        /// <param name="expectedContext_*">expected attribute context object - for each resolution option combination</param>
        /// <param name="expected_*">expected attribute object - for each resolution option combination</param>
        /// <returns></returns>
        protected static async Task RunTestWithValues(
            string testName,
            string sourceEntityName,

            AttributeContextExpectedValue expectedContext_default,
            AttributeContextExpectedValue expectedContext_normalized,
            AttributeContextExpectedValue expectedContext_referenceOnly,
            AttributeContextExpectedValue expectedContext_structured,
            AttributeContextExpectedValue expectedContext_normalized_structured,
            AttributeContextExpectedValue expectedContext_referenceOnly_normalized,
            AttributeContextExpectedValue expectedContext_referenceOnly_structured,
            AttributeContextExpectedValue expectedContext_referenceOnly_normalized_structured,

            List <AttributeExpectedValue> expected_default,
            List <AttributeExpectedValue> expected_normalized,
            List <AttributeExpectedValue> expected_referenceOnly,
            List <AttributeExpectedValue> expected_structured,
            List <AttributeExpectedValue> expected_normalized_structured,
            List <AttributeExpectedValue> expected_referenceOnly_normalized,
            List <AttributeExpectedValue> expected_referenceOnly_structured,
            List <AttributeExpectedValue> expected_referenceOnly_normalized_structured
            )
        {
            try
            {
                string testInputPath = TestHelper.GetInputFolderPath(TestsSubpath, testName);

                CdmCorpusDefinition corpus = new CdmCorpusDefinition();
                corpus.SetEventCallback(new EventCallback {
                    Invoke = CommonDataModelLoader.ConsoleStatusReport
                }, CdmStatusLevel.Warning);
                corpus.Storage.Mount("localInput", new LocalAdapter(testInputPath));
                corpus.Storage.Mount("cdm", new LocalAdapter(SchemaDocsPath));
                corpus.Storage.DefaultNamespace = "localInput";

                CdmEntityDefinition srcEntityDef = await corpus.FetchObjectAsync <CdmEntityDefinition>($"localInput:/{sourceEntityName}.cdm.json/{sourceEntityName}") as CdmEntityDefinition;

                Assert.IsTrue(srcEntityDef != null);

                var resOpt = new ResolveOptions
                {
                    WrtDoc     = srcEntityDef.InDocument,
                    Directives = new AttributeResolutionDirectiveSet(new HashSet <string> {
                    })
                };

                CdmEntityDefinition resolvedEntityDef = null;
                string outputEntityName     = string.Empty;
                string outputEntityFileName = string.Empty;
                string entityFileName       = string.Empty;

                if (expectedContext_default != null && expected_default != null)
                {
                    entityFileName       = "default";
                    resOpt.Directives    = new AttributeResolutionDirectiveSet(new HashSet <string> {
                    });
                    outputEntityName     = $"{sourceEntityName}_Resolved_{entityFileName}";
                    outputEntityFileName = $"{outputEntityName}.cdm.json";
                    resolvedEntityDef    = await srcEntityDef.CreateResolvedEntityAsync(outputEntityName, resOpt);

                    ValidateOutputWithValues(expectedContext_default, expected_default, resolvedEntityDef);
                }

                if (expectedContext_normalized != null && expected_normalized != null)
                {
                    entityFileName    = "normalized";
                    resOpt.Directives = new AttributeResolutionDirectiveSet(new HashSet <string> {
                        "normalized"
                    });
                    outputEntityName     = $"{sourceEntityName}_Resolved_{entityFileName}";
                    outputEntityFileName = $"{outputEntityName}.cdm.json";
                    resolvedEntityDef    = await srcEntityDef.CreateResolvedEntityAsync(outputEntityName, resOpt);

                    ValidateOutputWithValues(expectedContext_normalized, expected_normalized, resolvedEntityDef);
                }

                if (expectedContext_referenceOnly != null && expected_referenceOnly != null)
                {
                    entityFileName    = "referenceOnly";
                    resOpt.Directives = new AttributeResolutionDirectiveSet(new HashSet <string> {
                        "referenceOnly"
                    });
                    outputEntityName     = $"{sourceEntityName}_Resolved_{entityFileName}";
                    outputEntityFileName = $"{outputEntityName}.cdm.json";
                    resolvedEntityDef    = await srcEntityDef.CreateResolvedEntityAsync(outputEntityName, resOpt);

                    ValidateOutputWithValues(expectedContext_referenceOnly, expected_referenceOnly, resolvedEntityDef);
                }

                if (expectedContext_structured != null && expected_structured != null)
                {
                    entityFileName    = "structured";
                    resOpt.Directives = new AttributeResolutionDirectiveSet(new HashSet <string> {
                        "structured"
                    });
                    outputEntityName     = $"{sourceEntityName}_Resolved_{entityFileName}";
                    outputEntityFileName = $"{outputEntityName}.cdm.json";
                    resolvedEntityDef    = await srcEntityDef.CreateResolvedEntityAsync(outputEntityName, resOpt);

                    ValidateOutputWithValues(expectedContext_structured, expected_structured, resolvedEntityDef);
                }

                if (expectedContext_normalized_structured != null && expected_normalized_structured != null)
                {
                    entityFileName    = "normalized_structured";
                    resOpt.Directives = new AttributeResolutionDirectiveSet(new HashSet <string> {
                        "normalized", "structured"
                    });
                    outputEntityName     = $"{sourceEntityName}_Resolved_{entityFileName}";
                    outputEntityFileName = $"{outputEntityName}.cdm.json";
                    resolvedEntityDef    = await srcEntityDef.CreateResolvedEntityAsync(outputEntityName, resOpt);

                    ValidateOutputWithValues(expectedContext_normalized_structured, expected_normalized_structured, resolvedEntityDef);
                }

                if (expectedContext_referenceOnly_normalized != null && expected_referenceOnly_normalized != null)
                {
                    entityFileName    = "referenceOnly_normalized";
                    resOpt.Directives = new AttributeResolutionDirectiveSet(new HashSet <string> {
                        "referenceOnly", "normalized"
                    });
                    outputEntityName     = $"{sourceEntityName}_Resolved_{entityFileName}";
                    outputEntityFileName = $"{outputEntityName}.cdm.json";
                    resolvedEntityDef    = await srcEntityDef.CreateResolvedEntityAsync(outputEntityName, resOpt);

                    ValidateOutputWithValues(expectedContext_referenceOnly_normalized, expected_referenceOnly_normalized, resolvedEntityDef);
                }

                if (expectedContext_referenceOnly_structured != null && expected_referenceOnly_structured != null)
                {
                    entityFileName    = "referenceOnly_structured";
                    resOpt.Directives = new AttributeResolutionDirectiveSet(new HashSet <string> {
                        "referenceOnly", "structured"
                    });
                    outputEntityName     = $"{sourceEntityName}_Resolved_{entityFileName}";
                    outputEntityFileName = $"{outputEntityName}.cdm.json";
                    resolvedEntityDef    = await srcEntityDef.CreateResolvedEntityAsync(outputEntityName, resOpt);

                    ValidateOutputWithValues(expectedContext_referenceOnly_structured, expected_referenceOnly_structured, resolvedEntityDef);
                }

                if (expectedContext_referenceOnly_normalized_structured != null && expected_referenceOnly_normalized_structured != null)
                {
                    entityFileName    = "referenceOnly_normalized_structured";
                    resOpt.Directives = new AttributeResolutionDirectiveSet(new HashSet <string> {
                        "referenceOnly", "normalized", "structured"
                    });
                    outputEntityName     = $"{sourceEntityName}_Resolved_{entityFileName}";
                    outputEntityFileName = $"{outputEntityName}.cdm.json";
                    resolvedEntityDef    = await srcEntityDef.CreateResolvedEntityAsync(outputEntityName, resOpt);

                    ValidateOutputWithValues(expectedContext_referenceOnly_normalized_structured, expected_referenceOnly_normalized_structured, resolvedEntityDef);
                }
            }
            catch (Exception e)
            {
                Assert.Fail(e.Message);
            }
        }
 /// <summary>
 /// Runs validation to test actual output vs expected output for attributes collection vs attribute context
 /// </summary>
 /// <param name="expectedContext"></param>
 /// <param name="expectedAttributes"></param>
 /// <param name="actualResolvedEntityDef"></param>
 protected static void ValidateOutputWithValues(AttributeContextExpectedValue expectedContext, List <AttributeExpectedValue> expectedAttributes, CdmEntityDefinition actualResolvedEntityDef)
 {
     ObjectValidator.ValidateAttributesCollection(expectedAttributes, actualResolvedEntityDef.Attributes);
     ObjectValidator.ValidateAttributeContext(expectedContext, actualResolvedEntityDef.AttributeContext);
 }
예제 #11
0
        public async Task TestFilterInAllWithAttributeGroupRef()
        {
            bool   updateResults = false;
            string testName      = nameof(TestFilterInAllWithAttributeGroupRef);
            {
                string entityName = "Employee";

                AttributeContextExpectedValue expectedContext_default                             = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_normalized                          = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly                       = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_structured                          = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_normalized_structured               = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_normalized            = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_structured            = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_normalized_structured = new AttributeContextExpectedValue();

                List <AttributeExpectedValue> expected_default                             = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_normalized                          = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly                       = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_structured                          = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_normalized_structured               = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_normalized            = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_structured            = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_normalized_structured = new List <AttributeExpectedValue>();

                await RunTestWithValues(
                    testName,
                    entityName,

                    expectedContext_default,
                    expectedContext_normalized,
                    expectedContext_referenceOnly,
                    expectedContext_structured,
                    expectedContext_normalized_structured,
                    expectedContext_referenceOnly_normalized,
                    expectedContext_referenceOnly_structured,
                    expectedContext_referenceOnly_normalized_structured,

                    expected_default,
                    expected_normalized,
                    expected_referenceOnly,
                    expected_structured,
                    expected_normalized_structured,
                    expected_referenceOnly_normalized,
                    expected_referenceOnly_structured,
                    expected_referenceOnly_normalized_structured,
                    updateResults
                    );
            }
            {
                string entityName = "EmployeeNames";

                AttributeContextExpectedValue expectedContext_default                             = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_normalized                          = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly                       = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_structured                          = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_normalized_structured               = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_normalized            = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_structured            = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_normalized_structured = new AttributeContextExpectedValue();

                List <AttributeExpectedValue> expected_default                             = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_normalized                          = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly                       = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_structured                          = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_normalized_structured               = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_normalized            = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_structured            = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_normalized_structured = new List <AttributeExpectedValue>();

                await RunTestWithValues(
                    testName,
                    entityName,

                    expectedContext_default,
                    expectedContext_normalized,
                    expectedContext_referenceOnly,
                    expectedContext_structured,
                    expectedContext_normalized_structured,
                    expectedContext_referenceOnly_normalized,
                    expectedContext_referenceOnly_structured,
                    expectedContext_referenceOnly_normalized_structured,

                    expected_default,
                    expected_normalized,
                    expected_referenceOnly,
                    expected_structured,
                    expected_normalized_structured,
                    expected_referenceOnly_normalized,
                    expected_referenceOnly_structured,
                    expected_referenceOnly_normalized_structured,
                    updateResults
                    );
            }
        }
        public async Task TestForeignKeyManyToManyCardinality()
        {
            bool updateResults = false;

            string testName = "TestForeignKeyManyToManyCardinality";
            {
                string entityName = "Customer";

                AttributeContextExpectedValue expectedContext_default                             = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_normalized                          = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly                       = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_structured                          = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_normalized_structured               = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_normalized            = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_structured            = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_normalized_structured = new AttributeContextExpectedValue();

                List <AttributeExpectedValue> expected_default                             = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_normalized                          = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly                       = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_structured                          = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_normalized_structured               = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_normalized            = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_structured            = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_normalized_structured = new List <AttributeExpectedValue>();

                await RunTestWithValues(
                    testName,
                    entityName,

                    expectedContext_default,
                    expectedContext_normalized,
                    expectedContext_referenceOnly,
                    expectedContext_structured,
                    expectedContext_normalized_structured,
                    expectedContext_referenceOnly_normalized,
                    expectedContext_referenceOnly_structured,
                    expectedContext_referenceOnly_normalized_structured,

                    expected_default,
                    expected_normalized,
                    expected_referenceOnly,
                    expected_structured,
                    expected_normalized_structured,
                    expected_referenceOnly_normalized,
                    expected_referenceOnly_structured,
                    expected_referenceOnly_normalized_structured,
                    updateResults
                    );
            }
            {
                string entityName = "Product";

                AttributeContextExpectedValue expectedContext_default                             = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_normalized                          = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly                       = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_structured                          = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_normalized_structured               = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_normalized            = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_structured            = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_normalized_structured = new AttributeContextExpectedValue();

                List <AttributeExpectedValue> expected_default                             = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_normalized                          = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly                       = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_structured                          = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_normalized_structured               = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_normalized            = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_structured            = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_normalized_structured = new List <AttributeExpectedValue>();

                await RunTestWithValues(
                    testName,
                    entityName,

                    expectedContext_default,
                    expectedContext_normalized,
                    expectedContext_referenceOnly,
                    expectedContext_structured,
                    expectedContext_normalized_structured,
                    expectedContext_referenceOnly_normalized,
                    expectedContext_referenceOnly_structured,
                    expectedContext_referenceOnly_normalized_structured,

                    expected_default,
                    expected_normalized,
                    expected_referenceOnly,
                    expected_structured,
                    expected_normalized_structured,
                    expected_referenceOnly_normalized,
                    expected_referenceOnly_structured,
                    expected_referenceOnly_normalized_structured,
                    updateResults
                    );
            }
            {
                string entityName = "Sales";

                AttributeContextExpectedValue expectedContext_default                             = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_normalized                          = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly                       = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_structured                          = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_normalized_structured               = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_normalized            = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_structured            = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_normalized_structured = new AttributeContextExpectedValue();

                List <AttributeExpectedValue> expected_default                             = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_normalized                          = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly                       = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_structured                          = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_normalized_structured               = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_normalized            = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_structured            = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_normalized_structured = new List <AttributeExpectedValue>();

                await RunTestWithValues(
                    testName,
                    entityName,

                    expectedContext_default,
                    expectedContext_normalized,
                    expectedContext_referenceOnly,
                    expectedContext_structured,
                    expectedContext_normalized_structured,
                    expectedContext_referenceOnly_normalized,
                    expectedContext_referenceOnly_structured,
                    expectedContext_referenceOnly_normalized_structured,

                    expected_default,
                    expected_normalized,
                    expected_referenceOnly,
                    expected_structured,
                    expected_normalized_structured,
                    expected_referenceOnly_normalized,
                    expected_referenceOnly_structured,
                    expected_referenceOnly_normalized_structured,
                    updateResults
                    );
            }
        }
예제 #13
0
        public async Task TestFilterInAll()
        {
            string testName = "TestFilterInAll";
            {
                string entityName = "Employee";

                AttributeContextExpectedValue expectedContext_default                             = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_normalized                          = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly                       = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_structured                          = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_normalized_structured               = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_normalized            = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_structured            = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_normalized_structured = new AttributeContextExpectedValue();

                List <AttributeExpectedValue> expected_default                             = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_normalized                          = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly                       = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_structured                          = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_normalized_structured               = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_normalized            = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_structured            = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_normalized_structured = new List <AttributeExpectedValue>();

                await RunTestWithValues(
                    testName,
                    entityName,

                    expectedContext_default,
                    expectedContext_normalized,
                    expectedContext_referenceOnly,
                    expectedContext_structured,
                    expectedContext_normalized_structured,
                    expectedContext_referenceOnly_normalized,
                    expectedContext_referenceOnly_structured,
                    expectedContext_referenceOnly_normalized_structured,

                    expected_default,
                    expected_normalized,
                    expected_referenceOnly,
                    expected_structured,
                    expected_normalized_structured,
                    expected_referenceOnly_normalized,
                    expected_referenceOnly_structured,
                    expected_referenceOnly_normalized_structured
                    );
            }
            {
                string entityName = "EmployeeNames";

                AttributeContextExpectedValue expectedContext_default                             = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_normalized                          = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly                       = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_structured                          = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_normalized_structured               = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_normalized            = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_structured            = new AttributeContextExpectedValue();
                AttributeContextExpectedValue expectedContext_referenceOnly_normalized_structured = new AttributeContextExpectedValue();

                List <AttributeExpectedValue> expected_default                             = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_normalized                          = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly                       = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_structured                          = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_normalized_structured               = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_normalized            = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_structured            = new List <AttributeExpectedValue>();
                List <AttributeExpectedValue> expected_referenceOnly_normalized_structured = new List <AttributeExpectedValue>();

                await RunTestWithValues(
                    testName,
                    entityName,

                    expectedContext_default,
                    expectedContext_normalized,
                    expectedContext_referenceOnly,
                    expectedContext_structured,
                    expectedContext_normalized_structured,
                    expectedContext_referenceOnly_normalized,
                    expectedContext_referenceOnly_structured,
                    expectedContext_referenceOnly_normalized_structured,

                    expected_default,
                    expected_normalized,
                    expected_referenceOnly,
                    expected_structured,
                    expected_normalized_structured,
                    expected_referenceOnly_normalized,
                    expected_referenceOnly_structured,
                    expected_referenceOnly_normalized_structured
                    );
            }
        }