Пример #1
0
            public void ThenThereAreMatchingPayments(
                ProviderAdjustmentCalculator sut,
                List <ProviderAdjustment> testEarnings
                )
            {
                var actual = sut.CalculateDelta(new List <ProviderAdjustment>(), testEarnings, 0, 0).ToList();

                actual.ShouldContainPaymentMatchingEarning(testEarnings[0]);
                actual.ShouldContainPaymentMatchingEarning(testEarnings[1]);
                actual.ShouldContainPaymentMatchingEarning(testEarnings[2]);
            }
Пример #2
0
            public void ThenTheCollectionPeriodDetailsAreCalculatedCorrectly(int collectionPeriod, int academicYear, int expectedMonth, int expectedYear, string expectedName,
                                                                             ProviderAdjustmentCalculator sut,
                                                                             List <ProviderAdjustment> testEarnings
                                                                             )
            {
                var actual = sut.CalculateDelta(new List <ProviderAdjustment>(), testEarnings, academicYear, collectionPeriod).ToList();

                actual.Select(x => x.CollectionPeriodMonth).Should().AllBeEquivalentTo(expectedMonth);
                actual.Select(x => x.CollectionPeriodYear).Should().AllBeEquivalentTo(expectedYear);
                Assert.That(actual.Select(x => x.CollectionPeriodName).All(x => x == expectedName));
                actual.Select(x => x.SubmissionAcademicYear).Should().AllBeEquivalentTo(academicYear);
            }
Пример #3
0
            public void ThenTheTotalAmountPaidMatchesTheEarnings(
                ProviderAdjustmentCalculator sut,
                List <ProviderAdjustment> testEarnings
                )
            {
                var actual = sut.CalculateDelta(new List <ProviderAdjustment>(), testEarnings, 0, 0);

                var expectedTotal = testEarnings.Sum(x => x.Amount);

                actual.Should().HaveCount(testEarnings.Count);
                actual.Sum(x => x.Amount).Should().Be(expectedTotal);
            }
Пример #4
0
            public void ThenTheTotalAmountPaidMatchesThePreviousPayments(
                ProviderAdjustmentCalculator sut,
                List <ProviderAdjustment> testPreviousPayments
                )
            {
                var actual = sut.CalculateDelta(testPreviousPayments, new List <ProviderAdjustment>(), 0, 0);

                var expectedTotal = -1 * testPreviousPayments.Sum(x => x.Amount);

                actual.Should().HaveCount(testPreviousPayments.Count);
                actual.Sum(x => x.Amount).Should().Be(expectedTotal);
            }
Пример #5
0
            public void ThenThereAreOppositePayments(
                ProviderAdjustmentCalculator sut,
                List <ProviderAdjustment> testPreviousPayments
                )
            {
                var actual = sut.CalculateDelta(testPreviousPayments, new List <ProviderAdjustment>(), 0, 0).ToList();

                testPreviousPayments[0].Amount *= -1;
                testPreviousPayments[1].Amount *= -1;
                testPreviousPayments[2].Amount *= -1;

                actual.ShouldContainPaymentMatchingEarning(testPreviousPayments[0]);
                actual.ShouldContainPaymentMatchingEarning(testPreviousPayments[1]);
                actual.ShouldContainPaymentMatchingEarning(testPreviousPayments[2]);
            }
Пример #6
0
            public void AndThereIsNoChangeThereAreNoPayments(
                ProviderAdjustmentCalculator sut,
                List <ProviderAdjustment> testEarnings,
                List <ProviderAdjustment> testPreviousPayments
                )
            {
                for (var i = 0; i < 3; i++)
                {
                    AssociatePaymentWithEarning(testPreviousPayments[i], testEarnings[i]);
                    testPreviousPayments[i].SubmissionId = testEarnings[i].SubmissionId;
                    testPreviousPayments[i].Amount       = testEarnings[i].Amount;
                }

                var actual = sut.CalculateDelta(testPreviousPayments, testEarnings, 0, 0);

                actual.Sum(x => x.Amount).Should().Be(0);
            }
Пример #7
0
            public void ThenTheTotalAmountPaidMatchesTheEarnings(
                ProviderAdjustmentCalculator sut,
                List <ProviderAdjustment> testEarnings,
                List <ProviderAdjustment> testPreviousPayments
                )
            {
                for (var i = 0; i < 3; i++)
                {
                    AssociatePaymentWithEarning(testPreviousPayments[i], testEarnings[i]);
                }

                var actual = sut.CalculateDelta(testPreviousPayments, testEarnings, 0, 0);

                var expectedTotal = testEarnings.Sum(x => x.Amount) - testPreviousPayments.Sum(x => x.Amount);

                actual.Should().HaveCount(testEarnings.Count);
                actual.Sum(x => x.Amount).Should().Be(expectedTotal);
            }
Пример #8
0
            public void ThenThereAreMatchingPayments(
                ProviderAdjustmentCalculator sut,
                List <ProviderAdjustment> testEarnings,
                List <ProviderAdjustment> testPreviousPayments
                )
            {
                for (var i = 0; i < 3; i++)
                {
                    AssociatePaymentWithEarning(testPreviousPayments[i], testEarnings[i]);
                }

                var actual = sut.CalculateDelta(testPreviousPayments, testEarnings, 0, 0).ToList();

                testEarnings[0].Amount -= testPreviousPayments[0].Amount;
                testEarnings[1].Amount -= testPreviousPayments[1].Amount;
                testEarnings[2].Amount -= testPreviousPayments[2].Amount;

                actual.ShouldContainPaymentMatchingEarning(testEarnings[0]);
                actual.ShouldContainPaymentMatchingEarning(testEarnings[1]);
                actual.ShouldContainPaymentMatchingEarning(testEarnings[2]);
            }