Beispiel #1
0
        public void ShouldReproveTheRequest()
        {
            var mockDependency = new Mock <ICommitmentService>();

            mockDependency.Setup(x => x.GetCommitment(It.IsAny <string>()))
            .ReturnsAsync(0.8);
            var loan = new Loan
            {
                cpf    = "abc",
                amount = 2500,
                terms  = 6,
                score  = 700,
                income = 500
            };
            var commitmentPolicy = new CommitmentPolicy(mockDependency.Object);
            var result           = commitmentPolicy.ProcessCommitmentPolicy(loan).Result;

            Assert.False(result.commitment_policy_result);
            Assert.Null(result.commitment_terms_result);
        }
Beispiel #2
0
        public void ShouldApproveTheRequestButWithTheRequiredTerms()
        {
            var mockDependency = new Mock <ICommitmentService>();

            mockDependency.Setup(x => x.GetCommitment(It.IsAny <string>()))
            .ReturnsAsync(0.8);
            var loan = new Loan
            {
                cpf    = "abc",
                amount = 2500,
                terms  = 6,
                score  = 700,
                income = 5500
            };
            var commitmentPolicy = new CommitmentPolicy(mockDependency.Object);
            var result           = commitmentPolicy.ProcessCommitmentPolicy(loan).Result;

            Assert.True(result.commitment_policy_result);
            Assert.Equal(6, result.commitment_terms_result);
            Assert.NotEqual(0, result.commitment_terms_value);
        }