Exemplo n.º 1
0
        public void can_delete_track()
        {
            Track track = new Track{Artist = "Squarepusher", RunningTime = 5.2, Title = "Planetarium"};
            subject.SaveOrUpdate(track);

            subject.Delete(track);

            Assert.Throws<KeyNotFoundException>(()=>GetTrackById(track.Id));
        }
Exemplo n.º 2
0
        public void can_save_track()
        {
            Track track = new Track(){Artist = "Squarepusher", RunningTime = 5.2, Title = "Planetarium"};
            subject.SaveOrUpdate(track);

            Track resultTrack = GetTrackById(track.Id);

            Assert.That(resultTrack.Artist, Is.EqualTo("Squarepusher"));
            Assert.That(resultTrack.Title, Is.EqualTo("Planetarium"));
            Assert.That(resultTrack.RunningTime, Is.EqualTo(5.2));
        }
Exemplo n.º 3
0
        public void can_update_track()
        {
            Track initialTrack = new Track(){Artist = "Squarepusher", RunningTime = 5.2, Title = "Planetarium"};
            subject.SaveOrUpdate(initialTrack);

            Track resultTrack = GetTrackById(initialTrack.Id);

            Assert.That(resultTrack.Artist, Is.EqualTo("Squarepusher"));
            Assert.That(resultTrack.Title, Is.EqualTo("Planetarium"));
            Assert.That(resultTrack.RunningTime, Is.EqualTo(5.2));

            resultTrack.Artist = "Aphex";
            subject.SaveOrUpdate(resultTrack);

            var updatedTrack = GetTrackById(initialTrack.Id);

            Assert.That(updatedTrack.Artist, Is.EqualTo("Aphex"));
            Assert.That(updatedTrack.Title, Is.EqualTo("Planetarium"));
            Assert.That(updatedTrack.RunningTime, Is.EqualTo(5.2));
        }
Exemplo n.º 4
0
 public void SaveOrUpdate(Track track)
 {
     _connection.Hashes.Set(DB, track.Id.ToString(), track.ToByteArrayDictionary());
 }
Exemplo n.º 5
0
 public void Delete(Track track)
 {
     _connection.Keys.Remove(DB,track.Id.ToString());
 }