Skip to content

Commit

Permalink
Supress: IDE0059 Unnecessary assignment of a value ==> In tests, see …
Browse files Browse the repository at this point in the history
  • Loading branch information
timvandenhof committed Jul 22, 2021
1 parent 950b68a commit de573bd
Show file tree
Hide file tree
Showing 15 changed files with 2,162 additions and 1,929 deletions.
1 change: 1 addition & 0 deletions BuckarooSdk.Tests/BuckarooSdk.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@
<Compile Include="Constants\CustomImplementationLogger.cs" />
<Compile Include="Constants\TestSettings.cs" />
<Compile Include="General\GeneralTransactionTests.cs" />
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="Mocks\Afterpay.cs" />
<Compile Include="Mocks\KlarnaKP.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down
65 changes: 31 additions & 34 deletions BuckarooSdk.Tests/General/GeneralTransactionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using BuckarooSdk;
using BuckarooSdk.DataTypes;
using BuckarooSdk.DataTypes.RequestBases;
using BuckarooSdk.Tests.Constants;
Expand All @@ -13,18 +12,19 @@ namespace BuckarooSdk.Tests.General
[TestClass]
public class GeneralTransactionTests
{
private SdkClient SdkClient { get;set; }
private readonly SdkClient _buckarooClient;

public GeneralTransactionTests()
{
this.SdkClient = new SdkClient(TestSettings.Logger);
_buckarooClient = new SdkClient(TestSettings.Logger);
}

[TestMethod]
public void TransactionSpecificationTest()
{
var request = this.SdkClient.CreateRequest()
.Authenticate(Constants.TestSettings.WebsiteKey, Constants.TestSettings.SecretKey, false, new CultureInfo("nl-NL"))
var request = _buckarooClient
.CreateRequest()
.Authenticate(TestSettings.WebsiteKey, TestSettings.SecretKey, false, new CultureInfo("nl-NL"))
.TransactionSpecificationRequest()
.SpecificServiceSpecification("ideal", 2);

Expand All @@ -34,13 +34,14 @@ public void TransactionSpecificationTest()
[TestMethod]
public void MultipleSpecificationTest()
{
var request = this.SdkClient.CreateRequest()
.Authenticate(Constants.TestSettings.WebsiteKey, Constants.TestSettings.SecretKey, false, new CultureInfo("nl-NL"))
var request = _buckarooClient
.CreateRequest()
.Authenticate(TestSettings.WebsiteKey, TestSettings.SecretKey, false, new CultureInfo("nl-NL"))
.TransactionSpecificationRequest()
.MultipleServiceSpecifications(new TransactionSpecificationBase()
.AddService("ideal", 2)
.AddService("transfer")
.AddService("paypal")
.AddService("ideal", 2)
.AddService("transfer")
.AddService("paypal")
);

var response = request.GetMultipleSpecificiations();
Expand All @@ -51,7 +52,8 @@ public void MultipleSpecificationTest()
[TestMethod]
public void NoServiceTransactionTest()
{
var request = this.SdkClient.CreateRequest()
var request = _buckarooClient
.CreateRequest()
.Authenticate(TestSettings.WebsiteKey, TestSettings.SecretKey, false, new CultureInfo("nl-NL"))
.TransactionRequest()
.SetBasicFields(new TransactionBase // The transactionbase contains the base information of a transaction.
Expand All @@ -69,13 +71,12 @@ public void NoServiceTransactionTest()
.Pay();

var response = request.ExecuteAsync();

}

[TestMethod]
public void NoServiceTransactionTest2()
{
var request = this.SdkClient.CreateRequest();
var request = _buckarooClient.CreateRequest();
var authRequest = request.Authenticate(
TestSettings.WebsiteKey, TestSettings.SecretKey,
TestSettings.Test, CultureInfo.GetCultureInfo("nl-NL"),
Expand Down Expand Up @@ -108,7 +109,9 @@ public void CancelTransactionTest()
{
"94436C07DE6F44EBACBF26CB561F17B3",
};
var request = this.SdkClient.CreateRequest()

var request = _buckarooClient
.CreateRequest()
.Authenticate(TestSettings.WebsiteKey, TestSettings.SecretKey, false, new CultureInfo("nl-NL"))
.CancelTransactionRequest()
.CancelMultiple(new CancelTransactionBase(transactionsToBeCanceled));
Expand All @@ -122,8 +125,9 @@ public void TransactionStatusTest()
{
const string key = "12890D0FFE9F4840A69126DA2A93F1B6";

var request = this.SdkClient.CreateRequest()
.Authenticate(Constants.TestSettings.WebsiteKey, Constants.TestSettings.SecretKey, false, new CultureInfo("nl-NL"))
var request = _buckarooClient
.CreateRequest()
.Authenticate(TestSettings.WebsiteKey, TestSettings.SecretKey, false, new CultureInfo("nl-NL"))
.TransactionStatusRequest()
.Status(key);

Expand All @@ -132,38 +136,32 @@ public void TransactionStatusTest()
if (requestResponse.Status.Code.Code == BuckarooSdk.Constants.Status.WaitingForConsumer)
{
Process.Start("");

}
if (requestResponse.Status.Code.Code == BuckarooSdk.Constants.Status.Success)
{

}

//var logging = this.SdkClient.LoggerFactory.GetFullLog();
//Console.WriteLine(logging);

}

[TestMethod]
public void InvoiceInfoTest()
{

const string transactionKey = "244BD8425FB941B7B93E70F5AED31F3A";

var request = this.SdkClient.CreateRequest()
.Authenticate(Constants.TestSettings.WebsiteKey, Constants.TestSettings.SecretKey, false, new CultureInfo("nl-NL"))
var request = _buckarooClient
.CreateRequest()
.Authenticate(TestSettings.WebsiteKey, TestSettings.SecretKey, false, new CultureInfo("nl-NL"))
.TransactionInvoiceInfoRequest()
.SpecificInvoiceInfo(transactionKey);

var response = request.GetSingleInvoiceInfoRequest();

}

[TestMethod]
public void InvoicesInfoTest()
{
var request = this.SdkClient.CreateRequest()
.Authenticate(Constants.TestSettings.WebsiteKey, Constants.TestSettings.SecretKey, false, new CultureInfo("nl-NL"))
var request = _buckarooClient
.CreateRequest()
.Authenticate(TestSettings.WebsiteKey, TestSettings.SecretKey, false, new CultureInfo("nl-NL"))
.TransactionInvoiceInfoRequest()
.MultipleInvoicesInfo(new TransactionInvoiceInfoBase()
{
Expand All @@ -186,15 +184,14 @@ public void RefundInfoTest()
{
const string transactionKey = "8CC823FB3A9545B99608541DF4BC4DFF";

var request = this.SdkClient.CreateRequest()
.Authenticate(Constants.TestSettings.WebsiteKey, Constants.TestSettings.SecretKey, false, new CultureInfo("nl-NL"))
var request = _buckarooClient
.CreateRequest()
.Authenticate(TestSettings.WebsiteKey, TestSettings.SecretKey, false, new CultureInfo("nl-NL"))
.TransactionRefundInfoRequest()
.SpecificConfiguredTransactionRefundInfo(transactionKey);


var response = request.GetSingleRefundInfo();


Console.WriteLine();
}

Expand All @@ -209,7 +206,7 @@ public void RefundsInfoTest_Obsolete()
"fdaswerqrgtdgfsasdffwe",
};

var request = SdkClient.CreateRequest()
var request = _buckarooClient.CreateRequest()
.Authenticate(TestSettings.WebsiteKey, TestSettings.SecretKey, false, new CultureInfo("nl-NL"))
.TransactionRefundInfoRequest()
.MultipleConfiguredTransactionRefundInfo(new TransactionRefundInfoBase(transactionKeyList));
Expand All @@ -220,7 +217,7 @@ public void RefundsInfoTest_Obsolete()
[TestMethod]
public void RefundsInfoTest()
{
var request = SdkClient.CreateRequest()
var request = _buckarooClient.CreateRequest()
.Authenticate(TestSettings.WebsiteKey, TestSettings.SecretKey, false, new CultureInfo("nl-NL"))
.TransactionRefundInfoRequest()
.MultipleConfiguredTransactionRefundInfo();
Expand Down
Loading

0 comments on commit de573bd

Please sign in to comment.