public void ReadByTrackGroupIdWorksAsExpectedTest()
        {
            const int StaticStride = 5115;
            TagInfo   tagInfo      = tagService.GetTagInfo(PathToMp3);
            int       releaseYear  = tagInfo.Year;
            TrackData firstTrack   = new TrackData(
                tagInfo.ISRC, tagInfo.Artist, tagInfo.Title, tagInfo.Album, releaseYear, (int)tagInfo.Duration)
            {
                GroupId = "first-group-id"
            };
            TrackData secondTrack = new TrackData(
                tagInfo.ISRC, tagInfo.Artist, tagInfo.Title, tagInfo.Album, releaseYear, (int)tagInfo.Duration)
            {
                GroupId = "second-group-id"
            };

            int firstTrackId  = TrackDao.Insert(firstTrack);
            int secondTrackId = TrackDao.Insert(secondTrack);
            var firstHashData = fingerprintCommandBuilder
                                .BuildFingerprintCommand()
                                .From(PathToMp3, 20, 0)
                                .WithFingerprintConfig(config =>
            {
                config.Stride = new IncrementalStaticStride(StaticStride, config.SamplesPerFingerprint);
            })
                                .Hash()
                                .Result;

            foreach (var hash in firstHashData)
            {
                long subFingerprintId = SubFingerprintDao.Insert(hash.SubFingerprint, firstTrackId);
                HashBinDao.Insert(hash.HashBins, subFingerprintId);

                subFingerprintId = SubFingerprintDao.Insert(hash.SubFingerprint, secondTrackId);
                HashBinDao.Insert(hash.HashBins, subFingerprintId);
            }

            foreach (var hashData in firstHashData)
            {
                var subFingerprintData = HashBinDao.ReadSubFingerprintDataByHashBucketsThresholdWithGroupId(hashData.HashBins, 25, "first-group-id").ToList();

                Assert.IsTrue(subFingerprintData.Count == 1);
                Assert.AreEqual(firstTrackId, subFingerprintData[0].TrackReference.HashCode);

                subFingerprintData = HashBinDao.ReadSubFingerprintDataByHashBucketsThresholdWithGroupId(hashData.HashBins, 25, "second-group-id").ToList();

                Assert.IsTrue(subFingerprintData.Count == 1);
                Assert.AreEqual(secondTrackId, subFingerprintData[0].TrackReference.HashCode);

                subFingerprintData = HashBinDao.ReadSubFingerprintDataByHashBucketsWithThreshold(hashData.HashBins, 25).ToList();
                Assert.AreEqual(2, subFingerprintData.Count);
            }
        }
        public void ReadByTrackGroupIdWorksAsExpectedTest()
        {
            const int StaticStride = 5115;
            TagInfo   tagInfo      = this.GetTagInfo();
            int       releaseYear  = tagInfo.Year;
            TrackData firstTrack   = new TrackData(
                tagInfo.ISRC, tagInfo.Artist, tagInfo.Title, tagInfo.Album, releaseYear, (int)tagInfo.Duration)
            {
                GroupId = "first-group-id"
            };
            TrackData secondTrack = new TrackData(
                tagInfo.ISRC, tagInfo.Artist, tagInfo.Title, tagInfo.Album, releaseYear, (int)tagInfo.Duration)
            {
                GroupId = "second-group-id"
            };

            var firstTrackReference  = TrackDao.InsertTrack(firstTrack);
            var secondTrackReference = TrackDao.InsertTrack(secondTrack);

            var hashedFingerprints = fingerprintCommandBuilder
                                     .BuildFingerprintCommand()
                                     .From(PathToMp3, 20, 0)
                                     .WithFingerprintConfig(config =>
            {
                config.SpectrogramConfig.Stride = new IncrementalStaticStride(StaticStride, config.SamplesPerFingerprint);
            })
                                     .UsingServices(audioService)
                                     .Hash()
                                     .Result;

            InsertHashedFingerprintsForTrack(hashedFingerprints, firstTrackReference);
            InsertHashedFingerprintsForTrack(hashedFingerprints, secondTrackReference);

            const int ThresholdVotes = 25;

            foreach (var hashedFingerprint in hashedFingerprints)
            {
                var subFingerprintData = HashBinDao.ReadSubFingerprintDataByHashBucketsThresholdWithGroupId(hashedFingerprint.HashBins, ThresholdVotes, "first-group-id").ToList();

                Assert.IsTrue(subFingerprintData.Count == 1);
                Assert.AreEqual(firstTrackReference, subFingerprintData[0].TrackReference);

                subFingerprintData = HashBinDao.ReadSubFingerprintDataByHashBucketsThresholdWithGroupId(hashedFingerprint.HashBins, ThresholdVotes, "second-group-id").ToList();

                Assert.IsTrue(subFingerprintData.Count == 1);
                Assert.AreEqual(secondTrackReference, subFingerprintData[0].TrackReference);

                subFingerprintData = HashBinDao.ReadSubFingerprintDataByHashBucketsWithThreshold(hashedFingerprint.HashBins, ThresholdVotes).ToList();
                Assert.AreEqual(2, subFingerprintData.Count);
            }
        }