public void ItShouldDownloadTransactionReportFile() {
            // Cria o client que enviará a transação
            TransactionReportClient transactionReportClient = new TransactionReportClient(MerchantKey, _hostUri);

            // Faz o download para a variável
            HttpResponse httpResponse = transactionReportClient.DownloadReport(new DateTime(2015, 9, 19));

            Assert.AreEqual(HttpStatusCode.OK, httpResponse.HttpStatusCode);
        }
        public void ItShouldDownloadAndSaveTransactionReportFile() {
            // Cria o client que enviará a transação
            TransactionReportClient transactionReportClient = new TransactionReportClient(MerchantKey, _hostUri);

            // Generate temporary file
            string tempFile = Path.GetTempFileName();

            // Faz o download para o hd
            HttpStatusCode httpResponse = transactionReportClient.DownloadReportToFile(new DateTime(2015, 9, 19), tempFile);

            Assert.AreEqual(HttpStatusCode.OK, httpResponse);

            File.Delete(tempFile);
        }
        public void ItShouldParseTransactionReportFile() {
            // Cria o client que enviará a transação
            TransactionReportClient transactionReportClient = new TransactionReportClient(MerchantKey, _hostUri);

            // Faz o download para a variável
            HttpResponse httpResponse = transactionReportClient.DownloadReport(new DateTime(2015, 9, 19));

            Assert.AreEqual(HttpStatusCode.OK, httpResponse.HttpStatusCode);

            TransactionReportParser transactionReportParser = new TransactionReportParser();

            TransactionReport response = transactionReportParser.ParseString(httpResponse.RawResponse);

            Assert.AreEqual(response.Header.ReportFileCreateDate, new DateTime(2015, 9, 20));
        }
        public void ItShouldDownloadAndParseTransactionReport() {
            // Cria o client que enviará a transação
            TransactionReportClient transactionReportClient = new TransactionReportClient(MerchantKey, _hostUri);

            // Gera um arquivo temporário na máquina
            string tempFile = Path.GetTempFileName();

            // Faz o download para a variável
            HttpStatusCode httpResponse = transactionReportClient.DownloadReportToFile(new DateTime(2015, 9, 19), tempFile);


            Assert.AreEqual(HttpStatusCode.OK, httpResponse);

            TransactionReportParser transactionReportParser = new TransactionReportParser();

            // Faz o parse do arquivo temporário
            var response = transactionReportParser.ParseFile(tempFile);

            Assert.AreEqual(response.Header.ReportFileCreateDate, new DateTime(2015, 9, 20));

            // Deleta o arquivo temporário na máquina
            File.Delete(tempFile);
        }