コード例 #1
0
ファイル: UnitTest1.cs プロジェクト: cnt000/PepperProject
        public void TestMethod1()
        {
            var configuration = new Dictionary<string, Dictionary<string[], string[]>>
            {
                {
                    "code10", new Dictionary<string[], string[]>
                    {
                        {new[] {"100", "300", "500"}, new[] {"a", "b", "d.json"}},
                        {new[] {"1", "400", "50"}, new[] {"x", "y", "z.json"}}
                    }
                },
                {
                    "micro", new Dictionary<string[], string[]>
                    {
                        {new[] {"1", "30", "50"}, new[] {"a", "b", "f.json"}},
                        {new[] {"20", "40", "60"}, new[] {"x", "y", "j.json"}}
                    }
                },
                {
                    "macro", new Dictionary<string[], string[]>
                    {
                        {new[] {"1", "15", "15"}, new[] {"a", "b", "readytowear.json"}},
                        {new[] {"2", "4", "6"}, new[] {"x", "y", "z.json"}}
                    }
                }
            };

            string[] ids = {"100", "2", "3"};

            var label = GetLabelForDimensions.GetLabelForItem(ids, configuration);
        }
コード例 #2
0
        public void OneOccurrenceFirstTupleOnMacro()
        {
            var configuration = new Dictionary <string, Dictionary <string[], string[]> >
            {
                {
                    "code10", new Dictionary <string[], string[]>
                    {
                        { new[] { "100", "300", "500" }, new[] { "a", "b", "d.json" } },
                        { new[] { "1", "400", "50" }, new[] { "x", "y", "z.json" } }
                    }
                },
                {
                    "micro", new Dictionary <string[], string[]>
                    {
                        { new[] { "1", "30", "50" }, new[] { "a", "b", "f.json" } },
                        { new[] { "20", "40", "60" }, new[] { "x", "y", "j.json" } }
                    }
                },
                {
                    "macro", new Dictionary <string[], string[]>
                    {
                        { new[] { "1", "15", "112" }, new[] { "a", "b", "readytowear.json" } },
                        { new[] { "2", "4", "6" }, new[] { "x", "y", "z.json" } }
                    }
                }
            };

            //string[] ids = {"15", "2", "112"};
            var ids = new Dictionary <string, string>
            {
                { "code10", "15" },
                { "micro", "2" },
                { "macro", "112" }
            };

            var label = GetLabelForDimensions.GetLabelForItemForEach(ids, configuration);

            StringAssert.AreEqualIgnoringCase(label, "a/b/readytowear.json", "OneOccurrenceFirstTupleOnMacro");
        }
コード例 #3
0
        public void TwoOccurrencesFirstTupleOnCode10AndMicroWinMicro()
        {
            var configuration = new Dictionary <string, Dictionary <string[], string[]> >
            {
                {
                    "code10", new Dictionary <string[], string[]>
                    {
                        { new[] { "1001", "300", "500" }, new[] { "a", "b", "d.json" } },
                        { new[] { "1", "400", "50" }, new[] { "x", "y", "z.json" } }
                    }
                },
                {
                    "micro", new Dictionary <string[], string[]>
                    {
                        { new[] { "765", "100", "50" }, new[] { "a", "b", "f.json" } },
                        { new[] { "20", "40", "60" }, new[] { "x", "y", "j.json" } }
                    }
                },
                {
                    "macro", new Dictionary <string[], string[]>
                    {
                        { new[] { "1", "15", "15" }, new[] { "a", "b", "readytowear.json" } },
                        { new[] { "2", "4", "6789" }, new[] { "x", "y", "z.json" } }
                    }
                }
            };

            var ids = new Dictionary <string, string>
            {
                { "code10", "1001" },
                { "micro", "100" },
                { "macro", "9999" }
            };

            var label = GetLabelForDimensions.GetLabelForItemForEach(ids, configuration);

            StringAssert.AreEqualIgnoringCase(label, "a/b/f.json", "TwoOccurrencesFirstTupleOnCode10AndMicroWinMicro");
        }
コード例 #4
0
        public void Empty()
        {
            var configuration = new Dictionary <string, Dictionary <string[], string[]> >
            {
                {
                    "code10", new Dictionary <string[], string[]>
                    {
                        { new[] { "100", "300", "500" }, new[] { "a", "b", "d.json" } },
                        { new[] { "1", "44444", "50" }, new[] { "x", "y", "z.json" } }
                    }
                },
                {
                    "micro", new Dictionary <string[], string[]>
                    {
                        { new[] { "1", "30", "50" }, new[] { "a", "b", "f.json" } },
                        { new[] { "55555", "40", "60" }, new[] { "x", "y", "j.json" } }
                    }
                },
                {
                    "macro", new Dictionary <string[], string[]>
                    {
                        { new[] { "1", "15", "15" }, new[] { "a", "b", "readytowear.json" } },
                        { new[] { "2", "4", "66666" }, new[] { "x", "y", "z.json" } }
                    }
                }
            };
            var ids = new Dictionary <string, string>
            {
                { "code10", "12345" },
                { "micro", "67890" },
                { "macro", "09876" }
            };
            var label = GetLabelForDimensions.GetLabelForItemForEach(ids, configuration);

            StringAssert.AreEqualIgnoringCase(label, "",
                                              "Empty");
        }
コード例 #5
0
        public void ThreeOccurrencesSecondTupleOnCode10AndMicroAndMacroWinMacro()
        {
            var configuration = new Dictionary <string, Dictionary <string[], string[]> >
            {
                {
                    "code10", new Dictionary <string[], string[]>
                    {
                        { new[] { "100", "300", "500" }, new[] { "a", "b", "d.json" } },
                        { new[] { "1", "44444", "50" }, new[] { "x", "y", "z.json" } }
                    }
                },
                {
                    "micro", new Dictionary <string[], string[]>
                    {
                        { new[] { "1", "30", "50" }, new[] { "a", "b", "f.json" } },
                        { new[] { "55555", "40", "60" }, new[] { "x", "y", "j.json" } }
                    }
                },
                {
                    "macro", new Dictionary <string[], string[]>
                    {
                        { new[] { "1", "15", "15" }, new[] { "a", "b", "readytowear.json" } },
                        { new[] { "2", "4", "66666" }, new[] { "x", "y", "z.json" } }
                    }
                }
            };
            var ids = new Dictionary <string, string>
            {
                { "code10", "44444" },
                { "micro", "55555" },
                { "macro", "66666" }
            };
            var label = GetLabelForDimensions.GetLabelForItemForEach(ids, configuration);

            StringAssert.AreEqualIgnoringCase(label, "x/y/z.json",
                                              "ThreeOccurrencesSecondTupleOnCode10AndMicroAndMacroWinMacro");
        }