public void InsertFingerprintTest()
        {
            var track = new TrackData("isrc", "artist", "title", "album", 1986, 200);
            var trackReference = ModelService.InsertTrack(track);
            var fingerprint = new FingerprintData(GenericFingerprint, trackReference);

            ModelService.InsertFingerprint(fingerprint);

            AssertModelReferenceIsInitialized(fingerprint.FingerprintReference);
        }
Ejemplo n.º 2
0
        public IModelReference InsertFingerprint(FingerprintData fingerprint)
        {
            byte[] byteSignature = GetByteArrayFromBool(fingerprint.Signature);
            var fingerprintId = PrepareStoredProcedure(SpInsertFingerprint)
                                .WithParameter("Signature", byteSignature)
                                .WithParameter("TrackId", fingerprint.TrackReference.Id, DbType.Int32)
                                .Execute()
                                .AsScalar<int>();

            return fingerprint.FingerprintReference = new ModelReference<int>(fingerprintId);
        }
Ejemplo n.º 3
0
        public IModelReference InsertFingerprint(FingerprintData fingerprint)
        {
            if (!storage.Fingerprints.ContainsKey(fingerprint.TrackReference))
            {
                storage.Fingerprints[fingerprint.TrackReference] = new List<FingerprintData>();
            }

            storage.Fingerprints[fingerprint.TrackReference].Add(fingerprint);

            return fingerprint.FingerprintReference = new ModelReference<int>(Interlocked.Increment(ref counter));
        }
Ejemplo n.º 4
0
 public IModelReference InsertFingerprint(FingerprintData fingerprint)
 {
     return fingerprintDao.InsertFingerprint(fingerprint);
 }
        public void ReadFingerprintsByTrackReferenceTest()
        {
            TrackData track = new TrackData("isrc", "artist", "title", "album", 1986, 200);
            var trackReference = ModelService.InsertTrack(track);
            FingerprintData fingerprint = new FingerprintData(GenericFingerprint, trackReference);
            ModelService.InsertFingerprint(fingerprint);

            var fingerprints = ModelService.ReadFingerprintsByTrackReference(trackReference);

            Assert.IsTrue(fingerprints.Count == 1);
            Assert.AreEqual(fingerprint.FingerprintReference, fingerprints[0].FingerprintReference);
            Assert.AreEqual(trackReference, fingerprints[0].TrackReference);
            for (int i = 0; i < GenericFingerprint.Length; i++)
            {
                Assert.AreEqual(GenericFingerprint[i], fingerprints[0].Signature[i]);
            }
        }
Ejemplo n.º 6
0
 public IModelReference InsertFingerprint(FingerprintData fingerprintData)
 {
     var fingerprint = new Fingerprint { Signature = fingerprintData.Signature, TrackId = (ObjectId)fingerprintData.TrackReference.Id };
     GetCollection<Fingerprint>(Fingerprints).Insert(fingerprint);
     return fingerprintData.FingerprintReference = new MongoModelReference(fingerprint.Id);
 }