Esempio n. 1
0
        public void Orders_Dependent_Types_Later_Than_Their_Dependencies()
        {
            /*
             * Setup
             *
             * Alias    Parent    AllowedChildren    Compositions      Dependencies           Indirect                      All
             * d-1-1    d-1;                         cmp-1-1; cmp-2;   d-1; cmp-1-1; cmp-2;   cmp-1;                        d-1; cmp-1-1; cmp-2; cmp-1;
             * cmp-1-1                               cmp-1;            cmp-1;                                               cmp-1;
             * cmp-2
             * d-2                d-1; d-1-1;                          d-1; d-1-1;            d-1; cmp-1-1; cmp-2; cmp-1;   d-1; d-1-1; d-1; cmp-1-1; cmp-2; cmp-1;
             * cmp-1
             * d-1-2    d-1;                                           d-1;                   cmp-1;                        d-1; cmp-1;
             * d-1                                   cmp-1;            cmp-1;                                               cmp-1;
             *
             * Expectation
             * cmp-1
             * cmp-2
             * cmp-1-1
             * d-1
             * d-1-1
             * d-1-2
             * d-2
             *
             */


            Config.DocumentType("d-1-1")
            .Parent("d-1")
            .Compositions("cmp-1-1", "cmp-2");

            Config.DocumentType("cmp-1-1")
            .Compositions("cmp-1");

            Config.DocumentType("cmp-2");

            Config.DocumentType("d-2")
            .AllowedAsRoot(true)
            .AllowedChildren("d-1", "d-1-1");

            Config.DocumentType("cmp-1");

            Config.DocumentType("d-1-2")
            .Parent("d-1");

            Config.DocumentType("d-1")
            .Compositions("cmp-1");
            //.AllowedChildren("d-1-1"); // dammit! - what about circular references? (parent/allowedchildren) - rare UC?
            // See prevents circular reference test.

            var diff = Config.Compare();

            var orderedTypes = DependencyComparer.OrderByDependencies(diff.DocumentTypes.Values);
            var aliases      = orderedTypes.Select(t => t.Key);

            Approvals.VerifyJson(aliases.ToJson(Formatting.None));
        }
            public void UpdateSortingDirection(DependencySortMode mode, DependencyComparer currentComparer)
            {
                if (mode != currentComparer.mode)
                {
                    m_Arrow.text = string.Empty;
                    return;
                }

                m_Arrow.text = currentComparer.ascending ? k_AscendingArrow : k_DescendingArrow;
            }