public void TestListDocument() { chargebackDocumentUploadResponse docResponse = _docRequest.ListDocuments(1000); Assert.NotNull(docResponse); Assert.AreEqual("000", docResponse.responseCode); Assert.AreEqual("Success".ToLower(), docResponse.responseMessage.ToLower()); }
public void TestDeleteDocument() { chargebackDocumentUploadResponse docResponse = _docRequest.DeleteDocument(1000, "logo.tiff"); Assert.NotNull(docResponse); Assert.AreEqual("000", docResponse.responseCode); Assert.AreEqual("Success".ToLower(), docResponse.responseMessage.ToLower()); }
public void TestCase4() { // Step 1. Upload the file named maxsize.tif to the fourth test location. var tifSize = 1024; // 1024 bytes = 1KB. var tifFilename = "maxsize.mp3"; var fileCreator = File.OpenWrite(tifFilename); var fileBytes = new byte[tifSize]; fileCreator.Write(fileBytes, 0, fileBytes.Length); fileCreator.Close(); var caseId = int.Parse(_docRequest.Config.Get("merchantId") + "004"); var maxSizeResponse = _docRequest.UploadDocument(caseId, tifFilename); File.Delete(tifFilename); // Step 2. Verify that you receive the response code 005. Assert.AreEqual("005", maxSizeResponse.responseCode); Assert.AreEqual("Document already exists".ToLower(), maxSizeResponse.responseMessage.ToLower()); // Step 3. Upload a file with a size greather than 2MB. int hugeSize = 2 * 1024 * 1024 + 1024; // 2MB * 1024KB/MB * 1024byte/KB + 1024bytes; string hugeFilename = "huge.tif"; fileBytes = new byte[hugeSize]; fileCreator = File.OpenWrite(hugeFilename); fileCreator.Write(fileBytes, 0, fileBytes.Length); fileCreator.Close(); Console.WriteLine("Finish writing the file " + hugeFilename); chargebackDocumentUploadResponse hugeSizeResponse = _docRequest.UploadDocument(caseId, hugeFilename); File.Delete(hugeFilename); // Step 4. Verify that you receive the response code 012. Assert.AreEqual("012", hugeSizeResponse.responseCode); Assert.IsTrue(hugeSizeResponse.responseMessage.ToLower().Contains("Filesize exceeds limit of".ToLower())); // Step 5. Upload a file greater than 100KB, but less than 1MB. int mediumSize = 512000; // 500KB * 1024byte/KB = 512000 bytes. string mediumFilename = "medium.tif"; fileBytes = new byte[mediumSize]; fileCreator = File.OpenWrite(mediumFilename); fileCreator.Write(fileBytes, 0, fileBytes.Length); fileCreator.Close(); chargebackDocumentUploadResponse mediumSizeResponse = _docRequest.UploadDocument(caseId, mediumFilename); File.Delete(mediumFilename); // Step 6. Verify that you receive the response code 008. Assert.AreEqual("008", mediumSizeResponse.responseCode); Assert.AreEqual("Max Document Limit Per Case Reached".ToLower(), mediumSizeResponse.responseMessage.ToLower()); }