Exemplo n.º 1
0
        public void RetrieveTrackFromDatabase()
        {
            RecordingDataSet loadedFromDB = new RecordingDataSet();

            RecordingDataSet.Track loadedTrack = gateway.FindById(trackId, loadedFromDB);

            Assert.AreEqual(trackId, loadedTrack.Id);
            Assert.AreEqual(title, loadedTrack.Title);
            Assert.AreEqual(duration, loadedTrack.Duration);
        }
    public override void Insert()
    {
        recordingDataSet = new RecordingDataSet();

        recordingGateway = new RecordingGateway(Connection);
        trackGateway     = new TrackGateway(Connection);
        reviewGateway    = new ReviewGateway(Connection);
        reviewerGateway  = new ReviewerGateway(Connection);
        labelGateway     = new LabelGateway(Connection);
        artistGateway    = new ArtistGateway(Connection);
        genreGateway     = new GenreGateway(Connection);

        artistId    = artistGateway.Insert(recordingDataSet, "Artist");
        labelId     = labelGateway.Insert(recordingDataSet, "Label");
        genreId     = genreGateway.Insert(recordingDataSet, "Genre");
        reviewerId  = reviewerGateway.Insert(recordingDataSet, "Reviewer");
        recordingId = recordingGateway.Insert(recordingDataSet,
                                              "Recording Title", new DateTime(1999, 1, 12), artistId, labelId);
        reviewId = reviewGateway.Insert(recordingDataSet, 1, "Review");
        trackId  = trackGateway.Insert(recordingDataSet, "Track Title", 120);

        RecordingDataSet.Recording recording =
            recordingGateway.FindById(recordingId, recordingDataSet);

        RecordingDataSet.Review review =
            reviewGateway.FindById(reviewId, recordingDataSet);

        RecordingDataSet.Track track =
            trackGateway.FindById(trackId, recordingDataSet);

        RecordingDataSet.Label label =
            labelGateway.FindById(labelId, recordingDataSet);

        RecordingDataSet.Genre genre =
            genreGateway.FindById(genreId, recordingDataSet);

        RecordingDataSet.Artist artist =
            artistGateway.FindById(artistId, recordingDataSet);

        RecordingDataSet.Reviewer reviewer =
            reviewerGateway.FindById(reviewerId, recordingDataSet);

        // setup the relationships
        recording.Artist = artist;
        recording.Label  = label;
        track.Recording  = recording;
        track.Artist     = artist;
        track.Genre      = genre;
        review.Recording = recording;
        review.Reviewer  = reviewer;

        recordingGateway.Update(recordingDataSet);
        trackGateway.Update(recordingDataSet);
        reviewGateway.Update(recordingDataSet);

        RecordingDataSet loadedDataSet = new RecordingDataSet();

        loadedRecording = Catalog.FindByRecordingId(loadedDataSet, recordingId);
    }
 public override void CustomizeRecording()
 {
     trackGateway = new TrackGateway(Connection);
     trackId      = trackGateway.Insert(RecordingDataSet, "Track", 120);
     RecordingDataSet.Track track = trackGateway.FindById(trackId, RecordingDataSet);
     track.Recording = Recording;
     trackGateway.Update(RecordingDataSet);
 }
Exemplo n.º 4
0
        public new void SetUp()
        {
            base.SetUp();

            trackGateway = new TrackGateway(Connection);
            trackId      = trackGateway.Insert(RecordingDataSet, "Track", 120);
            RecordingDataSet.Track track = trackGateway.FindById(trackId, RecordingDataSet);
            track.Recording = Recording;
            trackGateway.Update(RecordingDataSet);
        }
Exemplo n.º 5
0
            public new void SetUp()
            {
                base.SetUp();

                trackGateway = new TrackGateway(Connection);
                trackId = trackGateway.Insert(RecordingDataSet, "Track", 120);
                RecordingDataSet.Track track = trackGateway.FindById(trackId, RecordingDataSet);
                track.Recording = Recording;
                trackGateway.Update(RecordingDataSet);
            }
Exemplo n.º 6
0
        public void Create()
        {
            recordingDataSet = new RecordingDataSet();

            artistGateway = new ArtistGateway(Connection);
            artistId      = artistGateway.Insert(recordingDataSet, "Artist");

            trackGateway = new TrackGateway(Connection);
            trackId      = trackGateway.Insert(recordingDataSet, "Title", 120);

            track = trackGateway.FindById(trackId, recordingDataSet);

            track.ArtistId = artistId;
            trackGateway.Update(recordingDataSet);
        }
        public void Create()
        {
            recordingDataSet = new RecordingDataSet();

            genreGateway = new GenreGateway(Connection);
            genreId      = genreGateway.Insert(recordingDataSet, "Genre");

            trackGateway = new TrackGateway(Connection);
            trackId      = trackGateway.Insert(recordingDataSet, "Title", 120);

            track = trackGateway.FindById(trackId, recordingDataSet);

            track.GenreId = genreId;
            trackGateway.Update(recordingDataSet);
        }