Skip to content

Commit

Permalink
2.51.0
Browse files Browse the repository at this point in the history
  • Loading branch information
braintreeps committed Oct 28, 2015
1 parent f9ad2ca commit edb5eaa
Show file tree
Hide file tree
Showing 104 changed files with 1,497 additions and 130 deletions.
6 changes: 4 additions & 2 deletions Braintree.Tests/AddOnTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public void Setup()
service = new BraintreeService(gateway.Configuration);
}

[Test()]
[Test]
[Category("Integration")]
public void All_ReturnsAllAddOns()
{
string addOnId = string.Format("dotnet_add_on{0}", new Random().Next(1000000).ToString());
Expand Down Expand Up @@ -61,7 +62,8 @@ public void All_ReturnsAllAddOns()
Assert.IsNotNull(addOn.UpdatedAt);
}

[Test()]
[Test]
[Category("Unit")]
public void All_RaisesIfMissingCredentials()
{
gateway = new BraintreeGateway
Expand Down
17 changes: 15 additions & 2 deletions Braintree.Tests/AddressTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public void Setup()
}

[Test]
[Category("Integration")]
public void Create_CreatesAddressForGivenCustomerId()
{
Customer customer = gateway.Customer.Create(new CustomerRequest()).Target;
Expand Down Expand Up @@ -64,6 +65,7 @@ public void Create_CreatesAddressForGivenCustomerId()
}

[Test]
[Category("Integration")]
public void Find_FindsAddress()
{
Customer customer = gateway.Customer.Create(new CustomerRequest()).Target;
Expand Down Expand Up @@ -96,6 +98,7 @@ public void Find_FindsAddress()
}

[Test]
[Category("Unit")]
public void Find_FindsErrorsOutOnWhitespaceIds()
{
try {
Expand All @@ -110,6 +113,7 @@ public void Find_FindsErrorsOutOnWhitespaceIds()
}

[Test]
[Category("Integration")]
public void Update_UpdatesAddressForGivenCustomerIdAndAddressId()
{
Customer customer = gateway.Customer.Create(new CustomerRequest()).Target;
Expand Down Expand Up @@ -165,7 +169,8 @@ public void Update_UpdatesAddressForGivenCustomerIdAndAddressId()
}

[Test]
public void Update_UpdatesAddress_WithInconsistenCounty()
[Category("Integration")]
public void Update_ReturnsAnErrorResult_ForInconsistenCountry()
{
Customer customer = gateway.Customer.Create(new CustomerRequest()).Target;

Expand Down Expand Up @@ -210,6 +215,7 @@ public void Update_UpdatesAddress_WithInconsistenCounty()
}

[Test]
[Category("Integration")]
public void Delete_DeletesTheAddress()
{
Customer customer = gateway.Customer.Create(new CustomerRequest()).Target;
Expand All @@ -222,7 +228,9 @@ public void Delete_DeletesTheAddress()

Address createdAddress = gateway.Address.Create(customer.Id, addressRequest).Target;
Assert.AreEqual(createdAddress.Id, gateway.Address.Find(customer.Id, createdAddress.Id).Id);
gateway.Address.Delete(customer.Id, createdAddress.Id);

Result<Address> result = gateway.Address.Delete(customer.Id, createdAddress.Id);
Assert.IsTrue(result.IsSuccess());
try
{
gateway.Address.Find(customer.Id, createdAddress.Id);
Expand All @@ -235,6 +243,7 @@ public void Delete_DeletesTheAddress()
}

[Test]
[Category("Integration")]
public void Create_ReturnsAnErrorResult()
{
Customer customer = gateway.Customer.Create(new CustomerRequest()).Target;
Expand All @@ -249,6 +258,7 @@ public void Create_ReturnsAnErrorResult()
}

[Test]
[Category("Integration")]
public void Create_ReturnsAnErrorResult_ForInconsistentCountry()
{
Customer customer = gateway.Customer.Create(new CustomerRequest()).Target;
Expand All @@ -267,6 +277,7 @@ public void Create_ReturnsAnErrorResult_ForInconsistentCountry()
}

[Test]
[Category("Integration")]
public void Create_ReturnsAnErrorResult_ForIncorrectAlpha2()
{
Customer customer = gateway.Customer.Create(new CustomerRequest()).Target;
Expand All @@ -284,6 +295,7 @@ public void Create_ReturnsAnErrorResult_ForIncorrectAlpha2()
}

[Test]
[Category("Integration")]
public void Create_ReturnsAnErrorResult_ForIncorrectAlpha3()
{
Customer customer = gateway.Customer.Create(new CustomerRequest()).Target;
Expand All @@ -301,6 +313,7 @@ public void Create_ReturnsAnErrorResult_ForIncorrectAlpha3()
}

[Test]
[Category("Integration")]
public void Create_ReturnsAnErrorResult_ForIncorrectNumeric()
{
Customer customer = gateway.Customer.Create(new CustomerRequest()).Target;
Expand Down
3 changes: 3 additions & 0 deletions Braintree.Tests/BraintreeServiceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace Braintree.Tests
public class BraintreeServiceTest
{
[Test]
[Category("Unit")]
public void SandboxSSLCertificateSuccessful()
{
try {
Expand All @@ -23,6 +24,7 @@ public void SandboxSSLCertificateSuccessful()
}

[Test]
[Category("Unit")]
public void ProductionSSLCertificateSuccessful()
{
ServicePointManager.ServerCertificateValidationCallback = TrustAllCertificates;
Expand All @@ -35,6 +37,7 @@ public void ProductionSSLCertificateSuccessful()
}

[Test]
[Category("Unit")]
public void ThrowExceptionIfErrorStatusCodeIsUpgradeRequired()
{
try {
Expand Down
10 changes: 10 additions & 0 deletions Braintree.Tests/ClientTokenTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace Braintree.Tests
public class ClientTokenTest
{
[Test]
[Category("Unit")]
public void Generate_RaisesExceptionIfVerifyCardIsIncludedWithoutCustomerId()
{
BraintreeGateway gateway = new BraintreeGateway
Expand Down Expand Up @@ -39,6 +40,7 @@ public void Generate_RaisesExceptionIfVerifyCardIsIncludedWithoutCustomerId()
}

[Test]
[Category("Unit")]
public void Generate_RaisesExceptionIfMakeDefaultIsIncludedWithoutCustomerId()
{
BraintreeGateway gateway = new BraintreeGateway
Expand Down Expand Up @@ -66,6 +68,7 @@ public void Generate_RaisesExceptionIfMakeDefaultIsIncludedWithoutCustomerId()
}

[Test]
[Category("Unit")]
public void Generate_RaisesExceptionIfFailOnDuplicatePaymentMethodIsIncludedWithoutCustomerId()
{
BraintreeGateway gateway = new BraintreeGateway
Expand Down Expand Up @@ -97,6 +100,7 @@ public void Generate_RaisesExceptionIfFailOnDuplicatePaymentMethodIsIncludedWith
public class ClientTokenTestIT
{
[Test]
[Category("Integration")]
public void Generate_GeneratedFingerprintIsAcceptedByGateway()
{
BraintreeGateway gateway = new BraintreeGateway
Expand All @@ -121,6 +125,7 @@ public void Generate_GeneratedFingerprintIsAcceptedByGateway()
}

[Test]
[Category("Integration")]
public void Generate_SupportsVersionOption()
{
BraintreeGateway gateway = new BraintreeGateway
Expand All @@ -141,6 +146,7 @@ public void Generate_SupportsVersionOption()
}

[Test]
[Category("Integration")]
public void Generate_DefaultsToVersionTwo()
{
BraintreeGateway gateway = new BraintreeGateway
Expand All @@ -157,6 +163,7 @@ public void Generate_DefaultsToVersionTwo()
}

[Test]
[Category("Integration")]
public void Generate_GatewayRespectsVerifyCard()
{
BraintreeGateway gateway = new BraintreeGateway
Expand Down Expand Up @@ -199,6 +206,7 @@ public void Generate_GatewayRespectsVerifyCard()
}

[Test]
[Category("Integration")]
public void Generate_GatewayRespectsFailOnDuplicatePaymentMethod()
{
BraintreeGateway gateway = new BraintreeGateway
Expand Down Expand Up @@ -253,6 +261,7 @@ public void Generate_GatewayRespectsFailOnDuplicatePaymentMethod()
}

[Test]
[Category("Integration")]
public void Generate_GatewayRespectsMakeDefault()
{
BraintreeGateway gateway = new BraintreeGateway
Expand Down Expand Up @@ -310,6 +319,7 @@ public void Generate_GatewayRespectsMakeDefault()
}

[Test]
[Category("Integration")]
public void Generate_ThrowExceptionWhenCustomerNotFound()
{
BraintreeGateway gateway = new BraintreeGateway
Expand Down
3 changes: 3 additions & 0 deletions Braintree.Tests/CoinbaseTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public void Setup()


[Test]
[Category("Integration")]
public void TransactionCreate()
{
TransactionRequest request = new TransactionRequest
Expand All @@ -48,6 +49,7 @@ public void TransactionCreate()
}

[Test]
[Category("Integration")]
public void Vault()
{
Result<Customer> customerResult = gateway.Customer.Create(new CustomerRequest());
Expand All @@ -66,6 +68,7 @@ public void Vault()
}

[Test]
[Category("Integration")]
public void Customer()
{
CustomerRequest request = new CustomerRequest
Expand Down
2 changes: 2 additions & 0 deletions Braintree.Tests/CollectionUtilTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ namespace Braintree.Tests
public class CollectionUtilTest
{
[Test]
[Category("Unit")]
public void Find_FindsValidCollectionValue()
{
Assert.AreEqual(SubscriptionStatus.ACTIVE, CollectionUtil.Find(SubscriptionStatus.STATUSES, "active", SubscriptionStatus.UNRECOGNIZED));
}

[Test]
[Category("Unit")]
public void Find_ReturnsUNRECOGNIZEDForInValidEnumValue()
{
Assert.AreEqual(SubscriptionDurationUnit.UNRECOGNIZED, CollectionUtil.Find(SubscriptionDurationUnit.ALL, "pants", SubscriptionDurationUnit.UNRECOGNIZED));
Expand Down
37 changes: 37 additions & 0 deletions Braintree.Tests/ConfigurationTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace Braintree.Tests
public class ConfigurationTest
{
[Test]
[Category("Unit")]
public void ConfigurationMissingEnvironment_ThrowsConfigurationException()
{
try {
Expand All @@ -25,6 +26,7 @@ public void ConfigurationMissingEnvironment_ThrowsConfigurationException()
}

[Test]
[Category("Unit")]
public void ConfigurationMissingMerchantId_ThrowsConfigurationException()
{
try {
Expand All @@ -39,6 +41,7 @@ public void ConfigurationMissingMerchantId_ThrowsConfigurationException()
}

[Test]
[Category("Unit")]
public void ConfigurationMissingPublicKey_ThrowsConfigurationException()
{
try {
Expand All @@ -53,6 +56,7 @@ public void ConfigurationMissingPublicKey_ThrowsConfigurationException()
}

[Test]
[Category("Unit")]
public void ConfigurationMissingPrivateKey_ThrowsConfigurationException()
{
try {
Expand All @@ -67,6 +71,7 @@ public void ConfigurationMissingPrivateKey_ThrowsConfigurationException()
}

[Test]
[Category("Unit")]
public void BaseMerchantURL_ReturnsDevelopmentURL()
{
BraintreeService service = new BraintreeService(new Configuration(
Expand All @@ -84,6 +89,7 @@ public void BaseMerchantURL_ReturnsDevelopmentURL()
}

[Test]
[Category("Unit")]
public void BaseMerchantURL_ReturnsSandboxURL()
{
BraintreeService service = new BraintreeService(new Configuration(
Expand All @@ -97,6 +103,7 @@ public void BaseMerchantURL_ReturnsSandboxURL()
}

[Test]
[Category("Unit")]
public void BaseMerchantURL_ReturnsProductionURL()
{
BraintreeService service = new BraintreeService(new Configuration(
Expand All @@ -110,6 +117,7 @@ public void BaseMerchantURL_ReturnsProductionURL()
}

[Test]
[Category("Unit")]
public void GetAuthorizationHeader_ReturnsBase64EncodePublicAndPrivateKeys()
{
BraintreeService service = new BraintreeService(new Configuration(
Expand All @@ -121,5 +129,34 @@ public void GetAuthorizationHeader_ReturnsBase64EncodePublicAndPrivateKeys()
Assert.AreEqual("Basic aW50ZWdyYXRpb25fcHVibGljX2tleTppbnRlZ3JhdGlvbl9wcml2YXRlX2tleQ==", service.GetAuthorizationHeader());

}

[Test]
[Category("Unit")]
public void Proxy_UsesNoProxyIfNotSpecified()
{
BraintreeService service = new BraintreeService(new Configuration(
Environment.DEVELOPMENT,
"integration_merchant_id",
"integration_public_key",
"integration_private_key"
));
Assert.AreEqual(null, service.GetProxy());
}

[Test]
[Category("Unit")]
public void Proxy_ReturnsProxyConfiguration()
{
Configuration configuration = new Configuration(
Environment.DEVELOPMENT,
"integration_merchant_id",
"integration_public_key",
"integration_private_key"
);

configuration.Proxy = "http://localhost:3000";
BraintreeService service = new BraintreeService(configuration);
Assert.AreEqual("http://localhost:3000", service.GetProxy());
}
}
}
Loading

0 comments on commit edb5eaa

Please sign in to comment.