public void TestConstructors() { // Test the empty constructor. var version = new XMLVersion(); Assert.AreEqual(version.MainVersion, 0); Assert.AreEqual(version.SubVersion, 0); Assert.AreEqual(version.ToString(), "0.0"); // Test the filled constructor. version = new XMLVersion(1, 2); Assert.AreEqual(version.MainVersion, 1); Assert.AreEqual(version.SubVersion, 2); Assert.AreEqual(version.ToString(), "1.2"); // Test the string constructors. version = XMLVersion.FromString(null); Assert.IsNull(version); version = XMLVersion.FromString("12"); Assert.AreEqual(version.MainVersion, 12); Assert.AreEqual(version.SubVersion, 0); Assert.AreEqual(version.ToString(), "12.0"); version = XMLVersion.FromString("12.13"); Assert.AreEqual(version.MainVersion, 12); Assert.AreEqual(version.SubVersion, 13); Assert.AreEqual(version.ToString(), "12.13"); }
/* * Runs a test transaction for a specific version. */ public void RunCnpTest <T>(cnpTransactionInterface transaction, XMLVersion version) { // Create the configuration. var config = new ConfigManager(new Dictionary <string, string> { { "reportGroup", "Default Report Group" }, { "username", "DOTNET" }, { "timeout", "15000" }, { "merchantId", "101" }, { "password", "TESTCASE" }, { "printxml", "true" }, { "neuterAccountNums", "true" }, { "version", version.ToString() } }); // Create a CNP Online object. var cnpOnline = new CnpOnline(config); // Perform the sync transaction, and validate the response. try { var transactionResponse = cnpOnline.SendTransaction <T>(transaction); this.ValidateResponse <T>(transactionResponse, version); } catch (Exception exception) { this.ValidateException(exception, version); } // Perform the async transaction, and validate the response. try { var transactionResponse = cnpOnline.SendTransactionAsync <T>(transaction, new CancellationToken()).Result; this.ValidateResponse <T>(transactionResponse, version); } catch (AggregateException exception) { this.ValidateException(exception.InnerException, version); } }