public void SetUp() { fingerprintService = new Mock <IFingerprintService>(MockBehavior.Strict); audioService = new Mock <IAudioService>(MockBehavior.Strict); lshAlgorithm = new Mock <ILocalitySensitiveHashingAlgorithm>(MockBehavior.Strict); fingerprintCommandBuilder = new FingerprintCommandBuilder(fingerprintService.Object, lshAlgorithm.Object); }
public void SetUp() { fingerprintService = new Mock <IFingerprintService>(MockBehavior.Strict); audioService = new Mock <IAudioService>(MockBehavior.Strict); lshAlgorithm = new Mock <ILocalitySensitiveHashingAlgorithm>(MockBehavior.Strict); DependencyResolver.Current.Bind <IFingerprintService, IFingerprintService>(fingerprintService.Object); DependencyResolver.Current.Bind <IAudioService, IAudioService>(audioService.Object); DependencyResolver.Current.Bind <ILocalitySensitiveHashingAlgorithm, ILocalitySensitiveHashingAlgorithm>( lshAlgorithm.Object); fingerprintCommandBuilder = new FingerprintCommandBuilder(); }
public void ShouldCreateExactlyTheSameFingerprints() { var fcb0 = new FingerprintCommandBuilder( new FingerprintService( new SpectrumService(new LomontFFT()), new StandardHaarWaveletDecomposition(), new FingerprintDescriptor(), new AudioSamplesNormalizer()), new LocalitySensitiveHashingAlgorithm( new MinHashService(new DefaultPermutations()), new HashConverter())); var fcb1 = new FingerprintCommandBuilder( new FingerprintService( new SpectrumService(new LomontFFT()), new StandardHaarWaveletDecomposition(), new FastFingerprintDescriptor(), new AudioSamplesNormalizer()), new LocalitySensitiveHashingAlgorithm( new MinHashService(new DefaultPermutations()), new HashConverter())); var fingerprints0 = fcb0.BuildFingerprintCommand() .From(GetAudioSamples()) .UsingServices(new NAudioService()) .Hash() .Result; fingerprints0.Sort( (fingerprint, hashedFingerprint) => fingerprint.SequenceNumber.CompareTo(hashedFingerprint.SequenceNumber)); var fingerprints1 = fcb1.BuildFingerprintCommand() .From(GetAudioSamples()) .UsingServices(new NAudioService()) .Hash() .Result; fingerprints1.Sort( (fingerprint, hashedFingerprint) => fingerprint.SequenceNumber.CompareTo(hashedFingerprint.SequenceNumber)); for (int i = 0; i < fingerprints0.Count; ++i) { CollectionAssert.AreEqual(fingerprints0[i].SubFingerprint, fingerprints1[i].SubFingerprint); } }
public void ShouldCreateExactlyTheSameFingerprints() { var fcb0 = new FingerprintCommandBuilder( new FingerprintService( new SpectrumService(new LomontFFT(), new LogUtility()), new LocalitySensitiveHashingAlgorithm( new MinHashService(new DefaultPermutations()), new HashConverter()), new StandardHaarWaveletDecomposition(), new FingerprintDescriptor())); var fcb1 = new FingerprintCommandBuilder( new FingerprintService( new SpectrumService(new LomontFFT(), new LogUtility()), new LocalitySensitiveHashingAlgorithm( new MinHashService(new DefaultPermutations()), new HashConverter()), new StandardHaarWaveletDecomposition(), new FastFingerprintDescriptor())); var audioService = new SoundFingerprintingAudioService(); var audioSamples = GetAudioSamples(); int testRuns = 5; for (int i = 0; i < testRuns; ++i) { var hashDatas0 = fcb0.BuildFingerprintCommand() .From(audioSamples) .UsingServices(audioService) .Hash() .Result; var hashDatas1 = fcb1.BuildFingerprintCommand() .From(audioSamples) .UsingServices(audioService) .Hash() .Result; AssertHashDatasAreTheSame(hashDatas0, hashDatas1); } }
public async Task ShouldCreateExactlyTheSameFingerprints() { var fcbWithOldFingerprintDescriptor = new FingerprintCommandBuilder( new FingerprintService( new SpectrumService(new LomontFFT(), new LogUtility()), LocalitySensitiveHashingAlgorithm.Instance, new StandardHaarWaveletDecomposition(), new FingerprintDescriptor())); var fcbWithFastFingerprintDescriptor = new FingerprintCommandBuilder( new FingerprintService( new SpectrumService(new LomontFFT(), new LogUtility()), LocalitySensitiveHashingAlgorithm.Instance, new StandardHaarWaveletDecomposition(), new FastFingerprintDescriptor())); var audioService = new SoundFingerprintingAudioService(); var audioSamples = GetAudioSamples(); int runs = 5; for (int i = 0; i < runs; ++i) { var hashDatas0 = await fcbWithOldFingerprintDescriptor.BuildFingerprintCommand() .From(audioSamples) .UsingServices(audioService) .Hash(); var hashDatas1 = await fcbWithFastFingerprintDescriptor.BuildFingerprintCommand() .From(audioSamples) .UsingServices(audioService) .Hash(); AssertHashDatasAreTheSame(hashDatas0, hashDatas1); } }
public void ResolveDefaultInterfacesForFingerprintCommandTest() { var fingerprintCommandBuilder = new FingerprintCommandBuilder(); Assert.IsNotNull(fingerprintCommandBuilder); }
public void SetUp() { fingerprintService = new Mock <IFingerprintService>(MockBehavior.Strict); audioService = new Mock <IAudioService>(MockBehavior.Strict); fingerprintCommandBuilder = new FingerprintCommandBuilder(fingerprintService.Object); }