Beispiel #1
0
        private void VerifyTestFile(string file, string[] sepparator, bool legacy = true)
        {
            //Arrange
            var fileContent = File.ReadAllText(file);
            var contents    = fileContent.Split(sepparator, StringSplitOptions.None);
            var csv         = from line in contents
                              select line.Split(',').ToArray();

            var  splitter = new Splitter();
            bool first    = true;

            var results = new List <string>();

            //Act
            foreach (string[] item in csv)
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    if (item.Length == 4)
                    {
                        var algo = legacy ? AlgorithmEnum.LegacyHash : AlgorithmEnum.Murmur;

                        var hash   = legacy ? splitter.LegacyHash(item[1], int.Parse(item[0])) : splitter.Hash(item[1], int.Parse(item[0]));
                        var bucket = splitter.GetBucket(item[1], int.Parse(item[0]), algo);

                        //Assert
                        Assert.AreEqual(hash, long.Parse(item[2]));
                        Assert.AreEqual(bucket, int.Parse(item[3]));
                    }
                }
            }
        }