diff --git a/.idea/.idea.EvoCalculator.Core/.idea/contentModel.xml b/.idea/.idea.EvoCalculator.Core/.idea/contentModel.xml
index dc7b71b..c0b50c7 100644
--- a/.idea/.idea.EvoCalculator.Core/.idea/contentModel.xml
+++ b/.idea/.idea.EvoCalculator.Core/.idea/contentModel.xml
@@ -40,6 +40,7 @@
+
@@ -107,6 +108,7 @@
+
diff --git a/.idea/.idea.EvoCalculator.Core/.idea/workspace.xml b/.idea/.idea.EvoCalculator.Core/.idea/workspace.xml
index 35ff862..4bdecec 100644
--- a/.idea/.idea.EvoCalculator.Core/.idea/workspace.xml
+++ b/.idea/.idea.EvoCalculator.Core/.idea/workspace.xml
@@ -14,10 +14,11 @@
-
-
+
+
+
@@ -62,20 +63,22 @@
-
-
+
+
+
+
@@ -140,7 +143,7 @@
-
+
1602593830686
@@ -184,98 +187,98 @@
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
-
+
-
+
@@ -288,10 +291,10 @@
-
+
-
+
@@ -305,4 +308,23 @@
+
+
+
+
+ file://$PROJECT_DIR$/EvoCalculator.Core.Tests/Calculation/Suite/Columns/PercentPaymentTests.cs
+ 152
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/EvoCalculator.Core.Calculation/Columns/PercentPaymentColumn.cs b/EvoCalculator.Core.Calculation/Columns/PercentPaymentColumn.cs
new file mode 100644
index 0000000..3578803
--- /dev/null
+++ b/EvoCalculator.Core.Calculation/Columns/PercentPaymentColumn.cs
@@ -0,0 +1,30 @@
+using System.Linq;
+using EvoCalculator.Core.Models.Calculation.Interfaces;
+using EvoCalculator.Core.Models.Calculation.Models.Prepared;
+
+namespace EvoCalculator.Core.Calculation.Columns
+{
+ public class PercentPaymentColumn : IColumn
+ {
+ public double[] Values { get; set; }
+
+ public PercentPaymentColumn(int count)
+ {
+ Values = new double[count];
+ }
+
+ public void ComputeValues(PreparedValues preparedValues, PreparedPayments preparedPayments,
+ Constants.Calculation constants,
+ params IColumn[] columns)
+ {
+ Values[0] = 0;
+ Values[1] = 0;
+ for (var i = 2; i < Values.Length - 1; i++)
+ {
+ Values[i] = preparedPayments.Rows[i - 1].PercentPayment;
+ }
+
+ Values[^1] = 0;
+ }
+ }
+}
\ No newline at end of file
diff --git a/EvoCalculator.Core.Models/Calculation/Models/Prepared/PreparedPayments.cs b/EvoCalculator.Core.Models/Calculation/Models/Prepared/PreparedPayments.cs
index a5c09e1..ef66f55 100644
--- a/EvoCalculator.Core.Models/Calculation/Models/Prepared/PreparedPayments.cs
+++ b/EvoCalculator.Core.Models/Calculation/Models/Prepared/PreparedPayments.cs
@@ -1,6 +1,6 @@
namespace EvoCalculator.Core.Models.Calculation.Models.Prepared
{
- public abstract class PaymentRow
+ public class PaymentRow
{
public int NumberPayment { get; set; }
public double PercentPayment { get; set; }
diff --git a/EvoCalculator.Core.Tests/Calculation/Suite/Columns/PercentPaymentTests.cs b/EvoCalculator.Core.Tests/Calculation/Suite/Columns/PercentPaymentTests.cs
new file mode 100644
index 0000000..89ecaeb
--- /dev/null
+++ b/EvoCalculator.Core.Tests/Calculation/Suite/Columns/PercentPaymentTests.cs
@@ -0,0 +1,362 @@
+using System;
+using EvoCalculator.Core.Calculation.Columns;
+using EvoCalculator.Core.Models.Calculation.Models.Prepared;
+using Xunit;
+
+namespace EvoCalculator.Core.Tests.Calculation.Suite.Columns
+{
+ public class PercentPaymentTests
+ {
+ [Fact]
+ public void DateTempTest1()
+ {
+ var preparedPayments = new PreparedPayments
+ {
+ Rows = new[]
+ {
+ new PaymentRow
+ {
+ PercentPayment = 25.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 100.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 100.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 100.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 100.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 75.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 75.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 75.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 75.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 50.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 50.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 50.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 50.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 100.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 100.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 100.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 100.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 75.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 75.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 75.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 75.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 50.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 50.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 1.00,
+ },
+ }
+ };
+
+ var percentPaymentColumn = new PercentPaymentColumn(preparedPayments.Rows.Length + 1);
+ percentPaymentColumn.ComputeValues(
+ null
+ , preparedPayments
+ , new Constants.Calculation()
+ , null);
+
+ var expected = new double[]
+ {
+ 0,
+ 0,
+ 100.00,
+ 100.00,
+ 100.00,
+ 100.00,
+ 75.00,
+ 75.00,
+ 75.00,
+ 75.00,
+ 50.00,
+ 50.00,
+ 50.00,
+ 50.00,
+ 100.00,
+ 100.00,
+ 100.00,
+ 100.00,
+ 75.00,
+ 75.00,
+ 75.00,
+ 75.00,
+ 50.00,
+ 50.00,
+ 0
+ };
+
+ var res = percentPaymentColumn.Values;
+ Assert.Equal(expected, res);
+ }
+
+ [Fact]
+ public void DateTempTest2()
+ {
+ var preparedPayments = new PreparedPayments
+ {
+ Rows = new[]
+ {
+ new PaymentRow
+ {
+ PercentPayment = 35
+ },
+ new PaymentRow
+ {
+ PercentPayment = 100.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 100.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 100.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 100.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 75.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 75.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 75.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 75.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 75.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 75.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 75.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 75.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 50.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 50.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 50.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 50.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 50.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 50.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 50.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 50.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 50.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 50.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 50.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 50.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 50.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 50.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 50.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 50.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 50.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 50.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 50.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 50.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 50.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 50.00,
+ },
+ new PaymentRow
+ {
+ PercentPayment = 1.00,
+ },
+ }
+ };
+
+ var percentPaymentColumn = new PercentPaymentColumn(preparedPayments.Rows.Length + 1);
+ percentPaymentColumn.ComputeValues(
+ null
+ , preparedPayments
+ , new Constants.Calculation()
+ , null);
+
+ var expected = new double[]
+ {
+ 0.00,
+ 0.00,
+ 100.00,
+ 100.00,
+ 100.00,
+ 100.00,
+ 75.00,
+ 75.00,
+ 75.00,
+ 75.00,
+ 75.00,
+ 75.00,
+ 75.00,
+ 75.00,
+ 50.00,
+ 50.00,
+ 50.00,
+ 50.00,
+ 50.00,
+ 50.00,
+ 50.00,
+ 50.00,
+ 50.00,
+ 50.00,
+ 50.00,
+ 50.00,
+ 50.00,
+ 50.00,
+ 50.00,
+ 50.00,
+ 50.00,
+ 50.00,
+ 50.00,
+ 50.00,
+ 50.00,
+ 50.00,
+ 0.00,
+ };
+
+ var res = percentPaymentColumn.Values;
+ Assert.Equal(expected, res);
+ }
+ }
+}
\ No newline at end of file