示例#1
0
        public override void Insert()
        {
            recordingDataSet = new RecordingDataSet();

            recordingGateway = new RecordingGateway(Connection);
            labelGateway     = new LabelGateway(Connection);
            artistGateway    = new ArtistGateway(Connection);

            artistId    = artistGateway.Insert(recordingDataSet, "Artist");
            labelId     = labelGateway.Insert(recordingDataSet, "Label");
            recordingId = recordingGateway.Insert(recordingDataSet,
                                                  "Recording Title", new DateTime(1999, 1, 12), artistId, labelId);

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

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

            recording.Artist = artist;
            recording.Label  = label;

            recordingGateway.Update(recordingDataSet);

            dto = gateway.FindByRecordingId(recording.Id);
        }
示例#2
0
    public void ReviewAddedToRecording()
    {
        int beforeCount = Recording.GetReviews().Length;

        ServiceGateway.ReviewDto dto =
            gateway.AddReview(reviewerName, reviewContent, rating, Recording.Id);

        ServiceGateway.RecordingDto recordingDto = gateway.FindByRecordingId(Recording.Id);
        Assert.AreEqual(beforeCount + 1, recordingDto.reviews.Length);

        gateway.DeleteReview(dto.id);
    }
示例#3
0
    public void ReviewDeletedFromRecording()
    {
        ServiceGateway.RecordingDto recordingDto =
            gateway.FindByRecordingId(Recording.Id);
        Assert.IsNull(recordingDto.reviews);

        ServiceGateway.ReviewDto dto =
            gateway.AddReview(reviewerName, reviewContent, rating, Recording.Id);
        gateway.DeleteReview(dto.id);

        recordingDto = gateway.FindByRecordingId(Recording.Id);
        Assert.IsNull(recordingDto.reviews);
    }
示例#4
0
 public void InvalidId()
 {
     ServiceGateway.RecordingDto nullDto = gateway.FindByRecordingId(2);
     Assert.IsNull(nullDto, "should be null");
 }
 public new void SetUp()
 {
     base.SetUp();
     dto = gateway.FindByRecordingId(Recording.Id);
 }