Skip to content

Commit

Permalink
Fixed failed tests.
Browse files Browse the repository at this point in the history
      - For tests using the
        https://apitest.authorize.net/xml/v1/request.api, the paypal
        and applypay tests fail. These failures are known.

      - For tests using the
        https://test.authorize.net/gateway/transact.dll, there are 4
        test failures. These failures need to be looked into more
        closely.
  • Loading branch information
xianwang423 committed Apr 20, 2015
1 parent b2be014 commit 76721ba
Show file tree
Hide file tree
Showing 7 changed files with 2,259 additions and 2,259 deletions.
531 changes: 268 additions & 263 deletions Authorize.NET/Utility/HttpXmlUtility.cs

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions AuthorizeNET.vsmdi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<TestLists xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2006">
<TestList name="Lists of Tests" id="8c43106b-9dc1-4907-a29f-aa66a61bf5b6">
<RunConfiguration id="b519da70-f2b9-42e9-8322-f70b4aedb1c0" name="Local Test Run" storage="localtestrun.testrunconfig" type="Microsoft.VisualStudio.TestTools.Common.TestRunConfiguration, Microsoft.VisualStudio.QualityTools.Common, PublicKeyToken=b03f5f7f11d50a3a" />
</TestList>
<?xml version="1.0" encoding="utf-8"?>
<TestLists xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
<TestList name="Lists of Tests" id="8c43106b-9dc1-4907-a29f-aa66a61bf5b6">
<RunConfiguration id="b519da70-f2b9-42e9-8322-f70b4aedb1c0" name="Local Test Run" storage="localtestrun.testrunconfig" type="Microsoft.VisualStudio.TestTools.Common.TestRunConfiguration, Microsoft.VisualStudio.QualityTools.Common, PublicKeyToken=b03f5f7f11d50a3a" />
</TestList>
</TestLists>
169 changes: 85 additions & 84 deletions AuthorizeNETtest/Api/Controllers/Test/APIInvalidCredentials.cs
Original file line number Diff line number Diff line change
@@ -1,84 +1,85 @@
namespace AuthorizeNet.Api.Controllers.Test
{
using System;
using System.Collections.Generic;
using NUnit.Framework;
using AuthorizeNet.Api.Contracts.V1;
using AuthorizeNet.Api.Controllers;
using AuthorizeNet.Api.Controllers.Bases;
using AuthorizeNet.Util;

[TestFixture]
public class CredentialsTest : ApiCoreTestBase
{

[TestFixtureSetUp]
public new static void SetUpBeforeClass()
{
ApiCoreTestBase.SetUpBeforeClass();
}

[TestFixtureTearDown]
public new static void TearDownAfterClass()
{
ApiCoreTestBase.TearDownAfterClass();
}

[SetUp]
public new void SetUp()
{
base.SetUp();
}

[TearDown]
public new void TearDown()
{
base.TearDown();
}

[Test]
public void InvalidCredentialsTest()
{
LogHelper.info(Logger, "CreateProfileWithCreateTransactionRequestTest");
merchantAuthenticationType badCredentials = new merchantAuthenticationType { name = "mbld_api_-NPA5n9k", Item = "123123", ItemElementName = ItemChoiceType.transactionKey };
ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = badCredentials;
ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = TestEnvironment;

//create request
getCustomerProfileRequest getCPReq = new getCustomerProfileRequest()
{
customerProfileId = "1234"
};

getCustomerProfileController getCPCont = new getCustomerProfileController(getCPReq);
getCPCont.Execute();
getCustomerProfileResponse getCPResp = getCPCont.GetApiResponse();

Assert.AreEqual("E00007", ((AuthorizeNet.Api.Contracts.V1.ANetApiResponse)(getCPResp)).messages.message[0].code);
ValidateErrorCode(((AuthorizeNet.Api.Contracts.V1.ANetApiResponse)(getCPResp)).messages, "E00007");
}

[Test]
public void IllFormedCredentialsTest()
{
LogHelper.info(Logger, "CreateProfileWithCreateTransactionRequestTest");
merchantAuthenticationType badCredentials = new merchantAuthenticationType { name = "mbld_api_-NPA5n9k", Item = "123123" }; //, ItemElementName = ItemChoiceType.transactionKey };
ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = badCredentials;

ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = TestEnvironment;

//create request
getCustomerProfileRequest getCPReq = new getCustomerProfileRequest()
{
customerProfileId = "1234"
};

getCustomerProfileController getCPCont = new getCustomerProfileController(getCPReq);
getCPCont.Execute();
getCustomerProfileResponse getCPResp = getCPCont.GetApiResponse();

Assert.AreEqual("E00007", ((AuthorizeNet.Api.Contracts.V1.ANetApiResponse)(getCPResp)).messages.message[0].code);
ValidateErrorCode(getCPResp.messages, "E00007");
}
}
}
namespace AuthorizeNet.Api.Controllers.Test
{
using System;
using System.Collections.Generic;
using NUnit.Framework;
using AuthorizeNet.Api.Contracts.V1;
using AuthorizeNet.Api.Controllers;
using AuthorizeNet.Api.Controllers.Bases;
using AuthorizeNet.Util;

[TestFixture]
public class CredentialsTest : ApiCoreTestBase
{

[TestFixtureSetUp]
public new static void SetUpBeforeClass()
{
ApiCoreTestBase.SetUpBeforeClass();
}

[TestFixtureTearDown]
public new static void TearDownAfterClass()
{
ApiCoreTestBase.TearDownAfterClass();
}

[SetUp]
public new void SetUp()
{
base.SetUp();
}

[TearDown]
public new void TearDown()
{
base.TearDown();
}

[Test]
public void InvalidCredentialsTest()
{
LogHelper.info(Logger, "CreateProfileWithCreateTransactionRequestTest");

var badCredentials = new merchantAuthenticationType { name = "mbld_api_-NPA5n9k", Item = "123123", ItemElementName = ItemChoiceType.transactionKey };
ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = badCredentials;
ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = TestEnvironment;

//create request
var getCpReq = new getCustomerProfileRequest
{
customerProfileId = "1234"
};

var getCpCont = new getCustomerProfileController(getCpReq);
getCpCont.Execute();
getCustomerProfileResponse getCpResp = getCpCont.GetApiResponse();

Assert.AreEqual("E00007", ((AuthorizeNet.Api.Contracts.V1.ANetApiResponse)(getCpResp)).messages.message[0].code);
ValidateErrorCode(((AuthorizeNet.Api.Contracts.V1.ANetApiResponse)(getCpResp)).messages, "E00007");
}

[Test]
public void IllFormedCredentialsTest()
{
LogHelper.info(Logger, "CreateProfileWithCreateTransactionRequestTest");

var badCredentials = new merchantAuthenticationType { name = "mbld_api_-NPA5n9k", Item = "123123" }; //, ItemElementName = ItemChoiceType.transactionKey };
ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = badCredentials;
ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = TestEnvironment;

//create request
var getCpReq = new getCustomerProfileRequest
{
customerProfileId = "1234"
};

var getCpCont = new getCustomerProfileController(getCpReq);
getCpCont.Execute();
var getCpResp = getCpCont.GetApiResponse();

Assert.AreEqual("E00007", ((AuthorizeNet.Api.Contracts.V1.ANetApiResponse)(getCpResp)).messages.message[0].code);
ValidateErrorCode(getCpResp.messages, "E00007");
}
}
}
Loading

0 comments on commit 76721ba

Please sign in to comment.