public void SameNumberOfHashBinsIsInsertedInAllTablesWhenFingerprintingEntireSongTest()
        {
            const int StaticStride       = 5115;
            TagInfo   tagInfo            = this.GetTagInfo();
            int       releaseYear        = tagInfo.Year;
            TrackData track              = new TrackData(tagInfo.ISRC, tagInfo.Artist, tagInfo.Title, tagInfo.Album, releaseYear, (int)tagInfo.Duration);
            var       trackReference     = TrackDao.InsertTrack(track);
            var       hashedFingerprints = fingerprintCommandBuilder
                                           .BuildFingerprintCommand()
                                           .From(PathToMp3)
                                           .WithFingerprintConfig(config =>
            {
                config.SpectrogramConfig.Stride = new IncrementalStaticStride(StaticStride, config.SamplesPerFingerprint);
            })
                                           .UsingServices(audioService)
                                           .Hash()
                                           .Result;

            InsertHashedFingerprintsForTrack(hashedFingerprints, trackReference);

            var hashes = HashBinDao.ReadHashedFingerprintsByTrackReference(track.TrackReference);

            Assert.AreEqual(hashedFingerprints.Count, hashes.Count);
            foreach (var data in hashes)
            {
                Assert.AreEqual(25, data.HashBins.Length);
            }
        }
        public void InsertReadTest()
        {
            TrackData track              = new TrackData("isrc", "artist", "title", "album", 1986, 200);
            var       trackReference     = TrackDao.InsertTrack(track);
            const int NumberOfHashBins   = 100;
            var       hashedFingerprints = Enumerable.Range(0, NumberOfHashBins).Select(i => new HashedFingerprint(GenericSignature, GenericHashBuckets, i, i * 0.928));

            InsertHashedFingerprintsForTrack(hashedFingerprints, trackReference);

            var hashedFingerprintss = HashBinDao.ReadHashedFingerprintsByTrackReference(track.TrackReference);

            Assert.AreEqual(NumberOfHashBins, hashedFingerprintss.Count);
        }
        public void ReadHashDataByTrackTest()
        {
            TrackData firstTrack = new TrackData("isrc", "artist", "title", "album", 2012, 200);

            var firstTrackReference = TrackDao.InsertTrack(firstTrack);

            var firstHashData = fingerprintCommandBuilder
                                .BuildFingerprintCommand()
                                .From(PathToMp3, 10, 0)
                                .UsingServices(audioService)
                                .Hash()
                                .Result;

            InsertHashedFingerprintsForTrack(firstHashData, firstTrackReference);

            TrackData secondTrack = new TrackData("isrc", "artist", "title", "album", 2012, 200);

            var secondTrackReference = TrackDao.InsertTrack(secondTrack);

            var secondHashData = fingerprintCommandBuilder
                                 .BuildFingerprintCommand()
                                 .From(PathToMp3, 20, 10)
                                 .UsingServices(audioService)
                                 .Hash()
                                 .Result;

            InsertHashedFingerprintsForTrack(secondHashData, secondTrackReference);

            var resultFirstHashData = HashBinDao.ReadHashedFingerprintsByTrackReference(firstTrackReference);

            AssertHashDatasAreTheSame(firstHashData, resultFirstHashData);

            IList <HashedFingerprint> resultSecondHashData = HashBinDao.ReadHashedFingerprintsByTrackReference(secondTrackReference);

            AssertHashDatasAreTheSame(secondHashData, resultSecondHashData);
        }