コード例 #1
0
        public void ShouldHandleNotExistingUriProperty()
        {
            string     testUri = "spotify:track:3QOruXa2lvqIFvOOa2rYyJ";
            SpotifyUri uri     = SpotifyUri.Parse(testUri);

            Assert.DoesNotThrow(() => uri.GetUriPropValue(UriType.user));
            Assert.IsNull(uri.GetUriPropValue(UriType.user));
        }
コード例 #2
0
        public void ShouldHandleNotExistingUriProperty()
        {
            string     testUri = "spotify:track:3QOruXa2lvqIFvOOa2rYyJ";
            SpotifyUri uri     = SpotifyUri.Parse(testUri);

            Action action = () => uri.GetUriPropValue(UriType.user);

            action.Should().NotThrow();
            uri.GetUriPropValue(UriType.user).Should().BeNull();
        }
コード例 #3
0
        public void ShouldCorrectlyParsePlaylistUri()
        {
            string     testUri = "spotify:user:spotifycharts:playlist:37i9dQZEVXbMDoHDwVN2tF";
            SpotifyUri uri     = SpotifyUri.Parse(testUri);

            uri.Base.Should().Be("spotify");
            uri.Type.Should().Be(UriType.playlist);
            uri.Id.Should().Be("37i9dQZEVXbMDoHDwVN2tF");

            uri.GetUriPropValue(UriType.user).Should().Be("spotifycharts");
            uri.ToString().Should().Be(testUri);
        }
コード例 #4
0
        public void ShouldCorrectlyParsePlaylistUri()
        {
            string     testUri = "spotify:user:spotifycharts:playlist:37i9dQZEVXbMDoHDwVN2tF";
            SpotifyUri uri     = SpotifyUri.Parse(testUri);

            Assert.AreEqual(uri.Base, "spotify");

            Assert.AreEqual(uri.Type, UriType.playlist);
            Assert.AreEqual(uri.Id, "37i9dQZEVXbMDoHDwVN2tF");

            Assert.AreEqual(uri.GetUriPropValue(UriType.user), "spotifycharts");
            Assert.AreEqual(uri.ToString(), testUri);
        }