Exemple #1
0
        public void WasNetworkAvailableDoesNotThrowExceptionWhenErrorIsEmpty()
        {
            var command           = new MockMusicClientCommand();
            var mix               = JToken.FromObject(new Mix());
            var availableResponse = new Response <JObject>(
                HttpStatusCode.OK,
                "application/vnd.nokia.ent",
                (JObject)mix,
                Guid.NewGuid());

            var response = command.ListItemResponseHandler(
                availableResponse,
                "items",
                (item, settings) => item);

            Assert.That(response.Succeeded);
            Assert.That(response.Error, Is.Not.InstanceOf <NetworkUnavailableException>());
        }
Exemple #2
0
        public void NetworkLimitedIsPassedThroughForLists()
        {
            var command             = new MockMusicClientCommand();
            var unavailableResponse = new Response <JObject>(
                HttpStatusCode.NotFound,
                new NetworkLimitedException("This is a message."),
                string.Empty,
                Guid.NewGuid());

            var response = command.ListItemResponseHandler(
                unavailableResponse,
                "items",
                (item, settings) => item);

            Assert.That(!response.Succeeded);
            Assert.That(response.Error, Is.InstanceOf <NetworkLimitedException>());
            Assert.That(response.Error.Message, Is.EqualTo("This is a message."));
        }