Beispiel #1
0
        public void ReturnComparisonForFirstProduct_WithPartialKnownExpectedValues()
        {
            var product = new Gen.List <LoanProduct>
            {
                new LoanProduct(1, "a", 1),
                new LoanProduct(2, "b", 2),
                new LoanProduct(3, "c", 3),
            };

            var sut = new ProductComparer(new LoanAmount("USD", 200_000m), product);

            Gen.List <MonthlyRepaymentComparison> comparisons = sut.CompareMonthlyRepayments(new LoanTerm(30));


            // Assert.That(comparisons, Has.Exactly(1).Property("ProductName").EqualTo("a")
            //     .And
            //     .Property("InterestRate").EqualTo(1)
            //     .And
            //     .Property("MonthlyRepayment").GreaterThan(0));


            Assert.That(comparisons, Has.Exactly(1).Matches <MonthlyRepaymentComparison>(item =>
                                                                                         item.ProductName == "a" &&
                                                                                         item.InterestRate == 1 &&
                                                                                         item.MonthlyRepayment > 0));
        }
Beispiel #2
0
        public void NotReturnDuplicateComparisons()
        {
            var product = new Gen.List <LoanProduct>
            {
                new LoanProduct(1, "a", 1),
                new LoanProduct(2, "b", 2),
                new LoanProduct(3, "c", 3),
            };

            var sut = new ProductComparer(new LoanAmount("USD", 200_000m), product);

            Gen.List <MonthlyRepaymentComparison> comparisons = sut.CompareMonthlyRepayments(new LoanTerm(30));
            Assert.That(comparisons, Is.Unique);
        }
Beispiel #3
0
        public void ReturnCorrectNumberOfComparisons()
        {
            var product = new Gen.List <LoanProduct>
            {
                new LoanProduct(1, "a", 1),
                new LoanProduct(2, "b", 2),
                new LoanProduct(3, "c", 3)
            };

            var sut = new ProductComparer(new LoanAmount("USD", 200_000m), product);

            Gen.List <MonthlyRepaymentComparison> comparisons = sut.CompareMonthlyRepayments(new LoanTerm(30));
            Assert.That(comparisons, Has.Exactly(3).Items);
        }
Beispiel #4
0
        public void ReturnComparisonForFirstProduct()
        {
            var product = new Gen.List <LoanProduct>
            {
                new LoanProduct(1, "a", 1),
                new LoanProduct(2, "b", 2),
                new LoanProduct(3, "c", 3),
            };

            var sut = new ProductComparer(new LoanAmount("USD", 200_000m), product);

            Gen.List <MonthlyRepaymentComparison> comparisons = sut.CompareMonthlyRepayments(new LoanTerm(30));

            var expectedProduct = new MonthlyRepaymentComparison("a", 1, 643.28m);

            Assert.That(comparisons, Does.Contain(expectedProduct));
        }