public void testUnload() { var unload = new unload(); unload.orderId = "2"; unload.orderSource = orderSourceType.ecommerce; unload.card = new cardType(); var mock = new Mock <Communications>(_memoryStreams); mock.Setup( Communications => Communications.HttpPost( It.IsRegex(".*?<litleOnlineRequest.*?<unload.*?<orderId>2</orderId>.*?</unload>.*?", RegexOptions.Singleline), It.IsAny <Dictionary <string, string> >())) .Returns( "<litleOnlineResponse version='8.21' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><unloadResponse><litleTxnId>123</litleTxnId></unloadResponse></litleOnlineResponse>"); var mockedCommunication = mock.Object; litle.setCommunication(mockedCommunication); var unloadResponse = litle.Unload(unload); Assert.AreEqual("123", unloadResponse.litleTxnId); }
public unloadResponse Unload(unload unload) { litleOnlineRequest request = createLitleOnlineRequest(); request.unload = unload; litleOnlineResponse response = sendToLitle(request); unloadResponse unloadResponse = response.unloadResponse; return(unloadResponse); }
public void addUnload(unload unload) { if (numAccountUpdates == 0) { numUnloads++; unloadAmount += unload.amount; tempBatchFilePath = saveElement(litleFile, litleTime, tempBatchFilePath, unload); } else { throw new LitleOnlineException(accountUpdateErrorMessage); } }
internal static void Add(ref unload unload) { Monitor.Enter(unloaderLock); try { if (state == unloadState.Run || state == unloadState.WaitTransaction) { unloaders.Add(unload); return; } } finally { Monitor.Exit(unloaderLock); } log.Default.Real("应用程序正在退出", null, false); }
public void TestUnload() { var unload = new unload(); unload.amount = 700; unload.orderSource = orderSourceType.ecommerce; unload.card = new giftCardCardType(); batchRequest.addUnload(unload); Assert.AreEqual(1, batchRequest.getNumUnloads()); Assert.AreEqual(700, batchRequest.getUnloadAmount()); mockCnpFile.Verify(cnpFile => cnpFile.createRandomFile(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), mockCnpTime.Object)); mockCnpFile.Verify(cnpFile => cnpFile.AppendLineToFile(mockFilePath, unload.Serialize())); }
public void TestUnload() { var unload = new unload(); unload.amount = 700; unload.orderSource = orderSourceType.ecommerce; unload.card = new cardType(); _batchRequest.addUnload(unload); Assert.AreEqual(1, _batchRequest.getNumUnloads()); Assert.AreEqual(700, _batchRequest.getUnloadAmount()); _mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), _mockLitleTime.Object)); _mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(MockFilePath, unload.Serialize())); }
public void TestUnload() { unload unload = new unload(); unload.orderId = "2"; unload.orderSource = orderSourceType.ecommerce; unload.card = new giftCardCardType(); var mock = new Mock <Communications>(); mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*?<cnpOnlineRequest.*?<unload.*?<orderId>2</orderId>.*?</unload>.*?", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >())) .Returns("<cnpOnlineResponse version='8.21' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><unloadResponse><cnpTxnId>123</cnpTxnId></unloadResponse></cnpOnlineResponse>"); Communications mockedCommunication = mock.Object; cnp.SetCommunication(mockedCommunication); unloadResponse unloadResponse = cnp.Unload(unload); Assert.AreEqual(123, unloadResponse.cnpTxnId); }
public void SimpleUnload() { var unload = new unload { id = "1", reportGroup = "Planets", orderId = "12344", amount = 1500, orderSource = orderSourceType.ecommerce, card = new giftCardCardType { type = methodOfPaymentTypeEnum.GC, number = "414100000000000000", cardValidationNum = "123", expDate = "1215" } }; var response = _litle.Unload(unload); Assert.AreEqual("000", response.response); }
public void testUnload_OnlyRequired() { unload unload = new unload(); unload.orderId = "12345"; unload.amount = 200; unload.orderSource = orderSourceType.ecommerce; unload.card = new giftCardCardType(); unload.id = "theId"; unload.reportGroup = "theReportGroup"; String actual = unload.Serialize(); String expected = @" <unload id=""theId"" reportGroup=""theReportGroup""> <orderId>12345</orderId> <amount>200</amount> <orderSource>ecommerce</orderSource> <card> <type>MC</type> </card> </unload>"; Assert.AreEqual(Regex.Replace(expected, @"\s+", String.Empty), Regex.Replace(actual, @"\s+", String.Empty)); }
public void testUnload_Full() { unload unload = new unload(); unload.orderId = "12345"; unload.amount = 200; unload.orderSource = orderSourceType.ecommerce; unload.card = new cardType(); unload.id = "theId"; unload.reportGroup = "theReportGroup"; String actual = unload.Serialize(); String expected = @" <unload id=""theId"" reportGroup=""theReportGroup""> <orderId>12345</orderId> <amount>200</amount> <orderSource>ecommerce</orderSource> <card> <type>MC</type> </card> </unload>"; Assert.AreEqual(expected, actual); }
public unloadResponse Unload(unload transaction) { return(this.SendTransaction <unloadResponse>(transaction)); }
public void testUnload_OnlyRequired() { unload unload = new unload(); unload.orderId = "12345"; unload.amount = 200; unload.orderSource = orderSourceType.ecommerce; unload.card = new cardType(); unload.id = "theId"; unload.reportGroup = "theReportGroup"; String actual = unload.Serialize(); String expected = @" <unload id=""theId"" reportGroup=""theReportGroup""> <orderId>12345</orderId> <amount>200</amount> <orderSource>ecommerce</orderSource> <card> <type>MC</type> </card> </unload>"; Assert.AreEqual(expected, actual); }
public unloadResponse Unload(unload unload) { litleOnlineRequest request = createLitleOnlineRequest(); request.unload = unload; litleOnlineResponse response = sendToLitle(request); unloadResponse unloadResponse = response.unloadResponse; return unloadResponse; }
public void testUnload() { var unload = new unload(); unload.orderId = "2"; unload.orderSource = orderSourceType.ecommerce; unload.card = new cardType(); var mock = new Mock<Communications>(_memoryStreams); mock.Setup( Communications => Communications.HttpPost( It.IsRegex(".*?<litleOnlineRequest.*?<unload.*?<orderId>2</orderId>.*?</unload>.*?", RegexOptions.Singleline), It.IsAny<Dictionary<string, string>>())) .Returns( "<litleOnlineResponse version='8.21' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><unloadResponse><litleTxnId>123</litleTxnId></unloadResponse></litleOnlineResponse>"); var mockedCommunication = mock.Object; litle.setCommunication(mockedCommunication); var unloadResponse = litle.Unload(unload); Assert.AreEqual("123", unloadResponse.litleTxnId); }
public void testUnload() { unload unload = new unload(); unload.amount = 700; unload.orderSource = orderSourceType.ecommerce; unload.card = new cardType(); batchRequest.addUnload(unload); Assert.AreEqual(1, batchRequest.getNumUnloads()); Assert.AreEqual(700, batchRequest.getUnloadAmount()); mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny<String>(), It.IsAny<String>(), It.IsAny<String>(), mockLitleTime.Object)); mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, unload.Serialize())); }
public void testUnload() { unload unload = new unload(); unload.orderId = "theOrderId"; unload.orderSource = orderSourceType.ecommerce; unload.card = new cardType(); var mockLitleResponse = new Mock<litleResponse>(); var mockLitleXmlSerializer = new Mock<litleXmlSerializer>(); mockXmlReader.SetupSequence(XmlReader => XmlReader.ReadOuterXml()) .Returns("<unloadResponse xmlns=\"http://www.litle.com/schema\"><litleTxnId>123</litleTxnId></unloadResponse>") .Returns("<unloadResponse xmlns=\"http://www.litle.com/schema\"><litleTxnId>124</litleTxnId></unloadResponse>"); batchResponse mockLitleBatchResponse = new batchResponse(); mockLitleBatchResponse.setUnloadResponseReader(mockXmlReader.Object); mockLitleResponse.Setup(litleResponse => litleResponse.nextBatchResponse()).Returns(mockLitleBatchResponse); litleResponse mockedLitleResponse = mockLitleResponse.Object; mockLitleXmlSerializer.Setup(litleXmlSerializer => litleXmlSerializer.DeserializeObjectFromFile(It.IsAny<String>())).Returns(mockedLitleResponse); Communications mockedCommunication = mockCommunications.Object; litle.setCommunication(mockedCommunication); litleXmlSerializer mockedLitleXmlSerializer = mockLitleXmlSerializer.Object; litle.setLitleXmlSerializer(mockedLitleXmlSerializer); litleFile mockedLitleFile = mockLitleFile.Object; litle.setLitleFile(mockedLitleFile); litle.setLitleTime(mockLitleTime.Object); batchRequest litleBatchRequest = new batchRequest(); litleBatchRequest.setLitleFile(mockedLitleFile); litleBatchRequest.setLitleTime(mockLitleTime.Object); litleBatchRequest.addUnload(unload); litleBatchRequest.addUnload(unload); litle.addBatch(litleBatchRequest); string batchFileName = litle.sendToLitle(); litleResponse actualLitleResponse = litle.receiveFromLitle(batchFileName); batchResponse actualLitleBatchResponse = actualLitleResponse.nextBatchResponse(); Assert.AreSame(mockLitleBatchResponse, actualLitleBatchResponse); Assert.AreEqual("123", actualLitleBatchResponse.nextUnloadResponse().litleTxnId); Assert.AreEqual("124", actualLitleBatchResponse.nextUnloadResponse().litleTxnId); Assert.IsNull(actualLitleBatchResponse.nextUnloadResponse()); mockCommunications.Verify(Communications => Communications.FtpDropOff(It.IsAny<String>(), mockFileName, It.IsAny<Dictionary<String, String>>())); mockCommunications.Verify(Communications => Communications.FtpPickUp(It.IsAny<String>(), It.IsAny<Dictionary<String, String>>(), mockFileName)); }
public unloadResponse Unload(unload unload) { return(SendRequest(response => response.unloadResponse, unload)); }