コード例 #1
0
        public void RefineReleaseDateTest()
        {
            var repository   = new Mock <IRepository>();
            var trackBll     = new TrackBll(repository.Object);
            var track        = new Track("song", "album", DateTime.Today, "<></>");
            var expectedDate = new DateTime(1977, 5, 13);

            trackBll.RefineReleaseDate(track, expectedDate);
            Assert.AreEqual(track.ReleaseDate, expectedDate);
        }
コード例 #2
0
        public void ChangeGenreTest()
        {
            var repository = new Mock <IRepository>();
            var trackBll   = new TrackBll(repository.Object);
            var artistBll  = new ArtistBll(repository.Object, trackBll);
            var artist     = new Artist("default", "default", "blues");

            artistBll.ChangeGenre(artist, "country");

            Assert.NotNull(artist.Genre);
            Assert.AreEqual(artist.Genre, "country");
        }
コード例 #3
0
        public void MergeArtistWithItselfThrowsError()
        {
            var repository = new Mock <IRepository>();
            var trackBll   = new TrackBll(repository.Object);
            var artistBll  = new ArtistBll(repository.Object, trackBll);

            var duplicate      = new Artist("one", "one", "one");
            var artistsToMerge = new List <Artist> {
                duplicate,
                duplicate,
                new Artist("two", "two", "two")
            };

            Assert.That(() => artistBll.MergeArtists(artistsToMerge, new Artist("target", "target", "target")), Throws.TypeOf <ArgumentException>());
        }
コード例 #4
0
        public void CopyTest()
        {
            var repository = new Mock <IRepository>();
            var trackBll   = new TrackBll(repository.Object);
            var artistBll  = new ArtistBll(repository.Object, trackBll);

            var track          = new Track("song", "album", DateTime.Today, "<></>");
            var originalArtist = new Artist("original", "default", "default");

            originalArtist.TrackList.Add(track);

            var anotherArtist = new Artist("another", "default", "default");
            var copy          = trackBll.Copy(track, anotherArtist);

            Assert.IsNotEmpty(originalArtist.TrackList);
            Assert.IsNotEmpty(anotherArtist.TrackList);
            Assert.True(originalArtist.TrackList.Contains(track));
            Assert.True(anotherArtist.TrackList.Contains(copy));
        }