示例#1
0
        public async Task HandleSuccessResponse()
        {
            var response = CreateResponseMessage(Encoding.UTF8.GetString(TrackApiResponses.TrackGetShouts));

            var parsed = await _command.HandleResponse(response);

            Assert.IsTrue(parsed.Success);
            Assert.IsNotNull(parsed.Content);
            Assert.IsTrue(parsed.Page == 5);
            Assert.IsTrue(parsed.Content.Count() == 7);
        }
        public async Task HandleSuccessResponse()
        {
            var response = CreateResponseMessage(Encoding.UTF8.GetString(AlbumApiResponses.AlbumGetShoutsMultiple));

            var parsed = await _command.HandleResponse(response);

            Assert.IsTrue(parsed.Success);
            Assert.IsNotNull(parsed.Content);

            var expectedShouts = new List <LastShout>
            {
                new LastShout("uhIgor", "Nunca vou cansar disso.", "Thu, 23 Oct 2014 02:20:30"),
                new LastShout("Zachary-K",
                              "Oblivion is the best song on whole album. Maybe i dig it but i don't want to really. Or i'm not in the right mood for it.",
                              "Wed, 17 Sep 2014 21:04:36")
            };

            var expectedJson = JsonConvert.SerializeObject(expectedShouts, Formatting.Indented);
            var actualJson   = JsonConvert.SerializeObject(parsed.Content, Formatting.Indented);

            Assert.AreEqual(expectedJson, actualJson, expectedJson.DifferencesTo(actualJson));
        }