Exemplo n.º 1
0
        public void GivenMoreComplexObject_WhenDumping_ThenShouldReturnCorrectString()
        {
            // Arrange
            object varToDump = new
            {
                Id             = 42,
                PropertyString = "toto",
                PropertyDouble = 4.2,
                PropertyObject = new
                {
                    SubProperty1 = "SubObject",
                    SubProperty2 = 422
                }
            };
            var expectedDump = @"{
  ""Id"": 42,
  ""PropertyString"": ""toto"",
  ""PropertyDouble"": 4.2,
  ""PropertyObject"": {
    ""SubProperty1"": ""SubObject"",
    ""SubProperty2"": 422
  }
}";

            // Act
            var resultOfVarDump = VarDump.VarDumpJson(varToDump);

            // Assert
            Assert.That(resultOfVarDump, Is.EqualTo(expectedDump), $"Essaye encore de trouver le VarDump de {varToDump}");
        }
        public void VarDumpTests_FieldDumpTest()
        {
            string s = VarDump.Var_Dump(new A());

            Console.WriteLine(s);
            Assert.IsTrue(true);
        }
Exemplo n.º 3
0
        protected async void Page_Load(object sender, EventArgs e)
        {
            // get a track
            var output = await SpotifyWebAPI.Track.GetTrack("0eGsygTp906u18L0Oimnem");

            ((Literal)this.Master.FindControl("output")).Text = VarDump.Dump(output, 0);
        }
Exemplo n.º 4
0
        protected async void Page_Load(object sender, EventArgs e)
        {
            // get search for alter bridge albums
            var output = await SpotifyWebAPI.Album.Search("Blackbird", "Alter Bridge");

            ((Literal)this.Master.FindControl("output")).Text = VarDump.Dump(output, 0);
        }
Exemplo n.º 5
0
        protected async void Page_Load(object sender, EventArgs e)
        {
            // get alter bridge's blackbird album
            var output = await SpotifyWebAPI.Album.GetAlbum("0Fk4lWAADmFMmuW6jp6xyE");

            ((Literal)this.Master.FindControl("output")).Text = VarDump.Dump(output, 0);
        }
Exemplo n.º 6
0
        protected async void Page_Load(object sender, EventArgs e)
        {
            // get alter bridge
            var output = await SpotifyWebAPI.Artist.GetArtist("4DWX7u8BV0vZIQSpJQQDWU");

            ((Literal)this.Master.FindControl("output")).Text = VarDump.Dump(output, 0);
        }
Exemplo n.º 7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected async void userGetCurrentUserProfile_Click(object sender, EventArgs e)
        {
            // get the user you just logged in with
            SpotifyWebAPI.User user = await SpotifyWebAPI.User.GetCurrentUserProfile(this.AuthenticationToken);

            output.Text = VarDump.Dump(user, 0);
        }
Exemplo n.º 8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected async void userGetUser_Click(object sender, EventArgs e)
        {
            // get my profile, returns a basic profile
            SpotifyWebAPI.User user = await SpotifyWebAPI.User.GetUser("tinyioda");

            output.Text = VarDump.Dump(user, 0);
        }
Exemplo n.º 9
0
        public void GivenSimpleObject_WhenDumping_ThenShouldReturnCorrectString(object varToDump, object expectedResult)
        {
            // Arrange & Act
            var resultOfVarDump = VarDump.VarDumpJson(varToDump);

            // Assert
            Assert.That(resultOfVarDump, Is.EqualTo(expectedResult), $"Essaye encore de trouver le VarDump de {varToDump}, type: {varToDump.GetType().Name}, depth: 1");
        }
Exemplo n.º 10
0
        protected async void Page_Load(object sender, EventArgs e)
        {
            List <string> artists = new List <string>();

            artists.Add("4DWX7u8BV0vZIQSpJQQDWU"); // alter bridge

            var output = await SpotifyWebAPI.Artist.GetArtists(artists);

            ((Literal)this.Master.FindControl("output")).Text = VarDump.Dump(output, 0);
        }
Exemplo n.º 11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected async void userCreatePlaylist_Click(object sender, EventArgs e)
        {
            // get the user
            SpotifyWebAPI.User user = await SpotifyWebAPI.User.GetCurrentUserProfile(this.AuthenticationToken);

            // create the playlist, this method also returns the playlist
            var newPlaylist = await SpotifyWebAPI.Playlist.CreatePlaylist(user.Id, "test", true, this.AuthenticationToken);

            output.Text = VarDump.Dump(newPlaylist, 0);
        }
Exemplo n.º 12
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected async void userGetPlaylists_Click(object sender, EventArgs e)
        {
            // get the user you just logged in with
            SpotifyWebAPI.User user = await SpotifyWebAPI.User.GetCurrentUserProfile(this.AuthenticationToken);

            // get this persons playlists
            SpotifyWebAPI.Page <Playlist> playlists = await user.GetPlaylists(this.AuthenticationToken);

            output.Text = VarDump.Dump(playlists, 0);
        }
Exemplo n.º 13
0
        protected async void Page_Load(object sender, EventArgs e)
        {
            var albums = new List <string>();

            albums.Add("0Fk4lWAADmFMmuW6jp6xyE"); // blackbird
            albums.Add("14XXkmq6rjlKTxRkelMtZx"); // fortress
            albums.Add("0ocWLhnTiUKSq8Ksa3FX4Z"); // AB III

            var output = await SpotifyWebAPI.Album.GetAlbums(albums);

            ((Literal)this.Master.FindControl("output")).Text = VarDump.Dump(output, 0);
        }
Exemplo n.º 14
0
        protected async void Page_Load(object sender, EventArgs e)
        {
            List <string> tracks = new List <string>();

            tracks.Add("0eGsygTp906u18L0Oimnem");
            tracks.Add("1lDWb6b6ieDQ2xT7ewTC3G");

            // get a track
            var output = await SpotifyWebAPI.Track.GetTracks(tracks);

            ((Literal)this.Master.FindControl("output")).Text = VarDump.Dump(output, 0);
        }
Exemplo n.º 15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected async void userGetPlaylist_Click(object sender, EventArgs e)
        {
            // get the user you just logged in with
            SpotifyWebAPI.User user = await SpotifyWebAPI.User.GetCurrentUserProfile(this.AuthenticationToken);

            // get all the playlists
            SpotifyWebAPI.Page <Playlist> playlists = await user.GetPlaylists(this.AuthenticationToken);

            // get the first playlist in the list
            // yes i know this is redundant but i am testing the method GetPlaylist()
            SpotifyWebAPI.Playlist playlist = await SpotifyWebAPI.Playlist.GetPlaylist(user, playlists.Items.FirstOrDefault().Id, this.AuthenticationToken);

            output.Text += VarDump.Dump(playlist, 0);

            // get the tracks
            // not by using GetPlaylist() in the previous command you already get the tracks, i'm just doing more testing here.
            SpotifyWebAPI.Page <PlaylistTrack> tracks = await playlist.GetPlaylistTracks(this.AuthenticationToken);

            output.Text += VarDump.Dump(tracks, 0);
        }
Exemplo n.º 16
0
 /// <summary>
 /// Extension do dump any object, only public properties, unforamtted.
 /// </summary>
 /// <typeparam name="T">any type</typeparam>
 /// <param name="objectToDump">object to dump</param>
 /// <returns></returns>
 public static string DumpUnFormatted <T>(this T objectToDump)
 {
     return(VarDump.VarDumpJsonUnFormatted(objectToDump));
 }
Exemplo n.º 17
0
 /// <summary>
 /// Extension do dump any object, only public properties.
 /// </summary>
 /// <typeparam name="T">any type</typeparam>
 /// <param name="objectToDump">object to dump</param>
 /// <returns></returns>
 public static string Dump <T>(this T objectToDump)
 {
     return(VarDump.VarDumpJson(objectToDump));
 }