public void SearchExtendedWarranty()
        {
            ExtendedWarrantyService service = new ExtendedWarrantyService();

            ExtendedWarrantyResponse response;
            ExtendedWarrantyRequest request;
            BasicAuth auth;

            List<SearchProduct> products = new List<SearchProduct>() {
                new SearchProduct("nokia", 1550.00),
                new SearchProduct("xpto", 10.00),
                new SearchProduct("samsung", 10.00)
            };

            request = new ExtendedWarrantyRequest(products);

            auth = new BasicAuth("*****@*****.**", "2948208E715B986F25A5E");

            string basic = auth.ToString();

            string bbasic = "Basic bG9qYW1vZGVsb0BwYWdhbWVudG9kaWdpdGFsLmNvbS5icjoyOTQ4MjA4RTcxNUI5ODZGMjVBNUU=";

            Assert.AreEqual<string>(basic, bbasic);

            response = service.SearchExtendedWarranty(request, auth);

            Assert.AreEqual<int>(response.code, 2);
            Assert.AreEqual<int>(response.products.Count, 3);

            ResponseProducts resp0 = response.products[0];
            Assert.AreEqual<string>(resp0.description, "nokia");
            Assert.AreEqual<decimal>(resp0.value, 1550.00m);
            Assert.IsTrue(resp0.extendedWarranty);
            Assert.AreEqual<string>(resp0.extendedWarrantyMessage, "Produto com garantia estendida");
            Assert.AreEqual<decimal>(resp0.valueExtendedWarranty, 150.63m);
            Assert.IsNotNull(resp0.token);

            ResponseProducts resp1 = response.products[1];
            Assert.AreEqual<string>(resp1.description, "xpto");
            Assert.AreEqual<decimal>(resp1.value, 10.00m);
            Assert.IsFalse(resp1.extendedWarranty);
            Assert.AreEqual<string>(resp1.extendedWarrantyMessage, "Produto não elegível de garantia");
            Assert.AreEqual<decimal>(resp1.valueExtendedWarranty, 0.0m);
            Assert.IsNull(resp1.token);

            ResponseProducts resp2 = response.products[2];
            Assert.AreEqual<string>(resp2.description, "samsung");
            Assert.AreEqual<decimal>(resp2.value, 10.00m);
            Assert.IsTrue(resp2.extendedWarranty);
            Assert.AreEqual<string>(resp2.extendedWarrantyMessage, "Produto com garantia estendida");
            Assert.AreEqual<decimal>(resp2.valueExtendedWarranty, 48.85m);
            Assert.IsNotNull(resp2.token);
        }
        /// <summary>
        /// Obtém o dicionário do cabeçalho de autenticação.
        /// </summary>
        /// <param name="authBasic">Objeto de dados para autenticação básica.</param>
        /// <returns>Dicionário preenchido com os Parâmetros e Valores.</returns>
        private Dictionary<string, string> GetAuthBasicHeader(BasicAuth authBasic)
        {
            string authBasicData = authBasic.ToString();

            return new Dictionary<string, string>(1) { { AuthConstants.AUTHORIZATION, authBasicData } };
        }
        /// <summary>
        /// Verifica se existe garantia estendida para os produtos referidos.
        /// </summary>
        /// <param name="request">Objeto que contém informações para a busca.</param>
        /// <param name="auth">Objeto que contém informações de autenticação para consumir o serviço.</param>
        /// <returns>Objeto que contém informações da busca e uma lista de contas.</returns>
        public ExtendedWarrantyResponse SearchExtendedWarranty(ExtendedWarrantyRequest request, BasicAuth auth)
        {
            string data = JsonConvert.SerializeObject(request,
                Formatting.None,
                new JsonSerializerSettings
                {
                    ContractResolver = new CamelCasePropertyNamesContractResolver(),
                    Converters = new List<JsonConverter>() {
                        { new BooleanConverter() },
                        { new DateTimeConverter() }
                    }
                });

            HttpClientResponse response = this.HttpClient.Post(
                ConfigUtil.UriSearchExtendedWarranty,
                this.GetParams(data),
                this.GetAuthBasicHeader(auth));

            if (response.HttpStatus != HttpStatusCode.OK)
            {
                // ErrorList
                throw new ServiceException(JsonConvert.DeserializeObject<ErrorList>(response.ResponseBody));
            }

            return JsonConvert.DeserializeObject<ExtendedWarrantyResponse>(response.ResponseBody); ;
        }
        private ExtendedWarrantyResponse searchExtendedWarranty(List<SearchProduct> products)
        {
            ExtendedWarrantyService service = new ExtendedWarrantyService();

            ExtendedWarrantyRequest request = new ExtendedWarrantyRequest(products);

            BasicAuth auth = new BasicAuth("*****@*****.**", "2948208E715B986F25A5E");

            return service.SearchExtendedWarranty(request, auth);
        }