Esempio n. 1
0
        public void BucketByTest(ItemKey itemKey, int expected)
        {
            // Setup the dictionary
            var dict = new ItemDictionary
            {
                ["game-1"] = new ConcurrentList <DatItem>
                {
                    new Rom
                    {
                        Name    = "rom-1",
                        Size    = 1024,
                        CRC     = "DEADBEEF",
                        SHA1    = "0000000fbbb37f8488100b1b4697012de631a5e6",
                        Machine = new Machine {
                            Name = "game-1"
                        },
                    },
                    new Rom
                    {
                        Name    = "rom-2",
                        Size    = 1024,
                        CRC     = "DEADBEEF",
                        SHA1    = "000000e948edcb4f7704b8af85a77a3339ecce44",
                        Machine = new Machine {
                            Name = "game-1"
                        },
                    },
                },
                ["game-2"] = new ConcurrentList <DatItem>
                {
                    new Rom
                    {
                        Name    = "rom-3",
                        Size    = 1024,
                        CRC     = "DEADBEEF",
                        SHA1    = "00000ea4014ce66679e7e17d56ac510f67e39e26",
                        Machine = new Machine {
                            Name = "game-2"
                        },
                    },
                    new Rom
                    {
                        Name    = "rom-4",
                        Size    = 1024,
                        CRC     = "DEADBEEF",
                        SHA1    = "00000151d437442e74e5134023fab8bf694a2487",
                        Machine = new Machine {
                            Name = "game-2"
                        },
                    },
                },
            };

            dict.BucketBy(itemKey, DedupeType.None);
            Assert.Equal(expected, dict.Keys.Count);
        }