コード例 #1
0
        public void FindAlbum_ArtistHrefAndAlbumNameIsNotNull_CallsLookupServiceArtistLookupWithArtistHref()
        {
            var lookupServiceFake   = A.Fake <ILookupService>();
            var spotifyAlbumService = new SpotifyAlbumService(lookupServiceFake);

            var album = spotifyAlbumService.FindAlbum("jkl", "abc", "def");

            A.CallTo(() => lookupServiceFake.ArtistLookup("jkl")).MustHaveHappened(Repeated.Exactly.Once);
        }
コード例 #2
0
        public void FindAlbum_ArtistLookupReturnsNull_ReturnsNull()
        {
            var lookupServiceFake = A.Fake <ILookupService>();

            A.CallTo(() => lookupServiceFake.ArtistLookup(A <string> .Ignored)).Returns(null);

            var spotifyAlbumService = new SpotifyAlbumService(lookupServiceFake);

            var album = spotifyAlbumService.FindAlbum("jkl", "abc", "def");

            Assert.That(album, Is.Null);
        }
コード例 #3
0
        public void FindAlbum_ArtistLookupArtistAlbumsIsEmpty_ReturnsNull()
        {
            var lookupServiceFake = A.Fake <ILookupService>();

            A.CallTo(() => lookupServiceFake.ArtistLookup(A <string> .Ignored)).Returns(new ArtistInfo {
                Artist = new SpotiKat.Spotify.Entities.Lookup.Artist {
                    Albums = new List <AlbumInfo>()
                }
            });

            var spotifyAlbumService = new SpotifyAlbumService(lookupServiceFake);

            var album = spotifyAlbumService.FindAlbum("jkl", "abc", "def");

            Assert.That(album, Is.Null);
        }
コード例 #4
0
        public void FindAlbum_ArtistLookupMatchingAlbumNameAndNullTerritory_ReturnsAlbum()
        {
            var lookupServiceFake = A.Fake <ILookupService>();

            A.CallTo(() => lookupServiceFake.ArtistLookup(A <string> .Ignored)).Returns(new ArtistInfo {
                Artist = new SpotiKat.Spotify.Entities.Lookup.Artist {
                    Albums = new List <AlbumInfo> {
                        new AlbumInfo {
                            Album = new SpotiKat.Spotify.Entities.Lookup.Album {
                                Name = "abc", Availability = new Availability {
                                    TerritoriesAsString = "def uio"
                                }
                            }
                        }
                    }
                }
            });

            var spotifyAlbumService = new SpotifyAlbumService(lookupServiceFake);

            var album = spotifyAlbumService.FindAlbum("jkl", "abc", null);

            Assert.That(album, Is.Not.Null);
        }
コード例 #5
0
        public void FindAlbum_AlbumNameIsNull_ThrowsArgumentNullException()
        {
            var spotifyAlbumService = new SpotifyAlbumService(A.Fake <ILookupService>());

            Assert.Throws <ArgumentNullException>(() => spotifyAlbumService.FindAlbum("jkl", null, "def"));
        }
コード例 #6
0
        public void FindAlbum_ArtistHrefIsNull_ThrowsArgumentNullException()
        {
            var spotifyAlbumService = new SpotifyAlbumService(A.Fake <ILookupService>());

            Assert.Throws <ArgumentNullException>(() => spotifyAlbumService.FindAlbum(null, "abc", "def"));
        }