public void When_ServerReturn_Success_Empty()
        {
            var client = TestBase.MockHttpClient(HttpStatusCode.OK, "[]");

            ICarDataProvider provider = new CarDataProvider(client, TestBase.MockAppSettings());
            var data = provider.GetAsync().Result;

            Assert.AreEqual(data.Count, 0);
        }
        public void When_ServerReturn_Error()
        {
            var client = TestBase.MockHttpClient(HttpStatusCode.InternalServerError, string.Empty);

            ICarDataProvider provider = new CarDataProvider(client, TestBase.MockAppSettings());
            var data = provider.GetAsync().Result;

            Assert.IsNull(data);
        }
        public void When_ServerReturn_Success_InvalidJson()
        {
            string json   = "[{\"id\":\"10001\"}]";
            var    client = TestBase.MockHttpClient(HttpStatusCode.OK, json);

            ICarDataProvider provider = new CarDataProvider(client, TestBase.MockAppSettings());
            var data = provider.GetAsync().Result;

            Assert.IsNull(data[0].Name);
        }
        public void When_ServerReturn_Success_Data()
        {
            string json   = "[{\"name\":\"Bradley\",\"cars\":[{\"brand\":\"MG\",\"colour\":\"Blue\"}]}]";
            var    client = TestBase.MockHttpClient(HttpStatusCode.OK, json);

            ICarDataProvider provider = new CarDataProvider(client, TestBase.MockAppSettings());
            var data = provider.GetAsync().Result;

            Assert.AreEqual(1, data.Count);
        }