public void UpdateClaimStatusIfAdjudicatedValueIsNotNull()
        {
            _mockPaymentResultLogic = new Mock <IPaymentResultRepository>();
            var paymentResults = new List <PaymentResult>
            {
                new PaymentResult {
                    ClaimId = 123, ContractId = 101, AdjudicatedValue = 100
                },
                new PaymentResult {
                    ClaimId = 123, ContractId = 101, ServiceTypeId = 10, AdjudicatedValue = 100
                }
            };
            var mockContractServiceTypeLogic = new Mock <IContractServiceTypeLogic>();
            var mockPaymentResultLogic       = new Mock <IPaymentResultLogic>();

            mockPaymentResultLogic.Setup(
                x =>
                x.Evaluate(It.IsAny <EvaluateableClaim>(), It.IsAny <List <PaymentResult> >(), It.IsAny <bool>(),
                           It.IsAny <bool>())).Returns(paymentResults);
            _target = new PaymentResultLogic(_mockPaymentResultLogic.Object);
            IEvaluateableClaim evaluateableClaim = new EvaluateableClaim();

            evaluateableClaim.ClaimId      = 123;
            evaluateableClaim.ClaimCharges = new List <ClaimCharge>
            {
                new ClaimCharge
                {
                    Line    = 1,
                    Amount  = 20,
                    RevCode = "250"
                }
            };
            var updatedPaymentResults = new List <PaymentResult>
            {
                new PaymentResult {
                    ClaimId = 123, AdjudicatedValue = 100, ContractId = 101, ServiceTypeId = 10
                },
                new PaymentResult {
                    ClaimId = 123, ContractId = 101
                }
            };

            var mockContractBaseLogic = new Mock <ContractBaseLogic>();

            mockContractServiceTypeLogic.Setup(x => x.Evaluate(evaluateableClaim, paymentResults, false, false))
            .Returns(updatedPaymentResults);
            mockContractBaseLogic.SetupAllProperties();


            //Act
            List <PaymentResult> actual = _target.Evaluate(evaluateableClaim, paymentResults, false, false);

            // Assert
            var firstOrDefault = actual.FirstOrDefault(q => q.ClaimStatus == 3);

            if (firstOrDefault != null)
            {
                Assert.AreEqual(3, firstOrDefault.ClaimStatus);
            }
        }
        public void GetPaymentResultsIfClaimNull()
        {
            _mockPaymentResultLogic = new Mock <IPaymentResultRepository>();
            var paymentResults = new List <PaymentResult>
            {
                new PaymentResult {
                    ClaimId = 123, AdjudicatedValue = 100, ContractId = 101
                },
                new PaymentResult {
                    ClaimId = 123, ContractId = 101
                }
            };
            var mockPaymentResultLogic = new Mock <IPaymentResultLogic>();

            mockPaymentResultLogic.Setup(
                x =>
                x.Evaluate(It.IsAny <EvaluateableClaim>(), It.IsAny <List <PaymentResult> >(), It.IsAny <bool>(),
                           It.IsAny <bool>())).Returns(paymentResults);
            _target = new PaymentResultLogic(_mockPaymentResultLogic.Object);

            //Act
            List <PaymentResult> actual = _target.GetPaymentResults(null);

            // Assert
            Assert.AreEqual(0, actual.Count);
        }
        public void UpdatePaymentResultsTest()
        {
            _mockPaymentResultLogic = new Mock <IPaymentResultRepository>();
            var paymentResults = new List <PaymentResult>
            {
                new PaymentResult {
                    ClaimId = 138411511, AdjudicatedValue = null, ContractId = 1, Line = 2
                },
                new PaymentResult {
                    ClaimId = 138411511, AdjudicatedValue = 10, ContractId = 1, ServiceTypeId = 1, Line = 1
                },
                new PaymentResult {
                    ClaimId = 138411511, AdjudicatedValue = 10, ContractId = 1, ServiceTypeId = 1, Line = 1, PaymentTypeId = 1
                }
            };
            var paymentResultDictionary = new Dictionary <long, List <PaymentResult> >
            {
                { 1, paymentResults }
            };

            _target = new PaymentResultLogic(_mockPaymentResultLogic.Object);
            var actual = _target.UpdatePaymentResults(paymentResultDictionary, 250, 10345, null, null);

            Assert.AreEqual(false, actual);
        }
        public void EvaluateIfLineIsNullTest()
        {
            _mockPaymentResultLogic = new Mock <IPaymentResultRepository>();
            var paymentResults = new List <PaymentResult>
            {
                new PaymentResult {
                    ClaimId = 123, ServiceTypeId = 1
                },
                new PaymentResult {
                    ClaimId = 123, ServiceTypeId = 1
                }
            };
            var mockContractServiceTypeLogic = new Mock <IContractServiceTypeLogic>();
            var mockPaymentResultLogic       = new Mock <IPaymentResultLogic>();

            mockPaymentResultLogic.Setup(
                x =>
                x.Evaluate(It.IsAny <EvaluateableClaim>(), It.IsAny <List <PaymentResult> >(), It.IsAny <bool>(),
                           It.IsAny <bool>())).Returns(paymentResults);
            _target = new PaymentResultLogic(_mockPaymentResultLogic.Object);
            IEvaluateableClaim evaluateableClaim = new EvaluateableClaim();

            evaluateableClaim.ClaimId      = 123;
            evaluateableClaim.ClaimCharges = new List <ClaimCharge>
            {
                new ClaimCharge
                {
                    Line    = 1,
                    Amount  = 20,
                    RevCode = "250"
                }
            };
            var updatedPaymentResults = new List <PaymentResult>
            {
                new PaymentResult {
                    ClaimId = 123, Line = 1
                },
                new PaymentResult {
                    ClaimId = 123
                }
            };

            var mockContractBaseLogic = new Mock <ContractBaseLogic>();

            mockContractServiceTypeLogic.Setup(x => x.Evaluate(evaluateableClaim, paymentResults, false, false))
            .Returns(updatedPaymentResults);
            mockContractBaseLogic.SetupAllProperties();


            //Act
            List <PaymentResult> actual = _target.Evaluate(evaluateableClaim, paymentResults, false, false);

            // Assert
            Assert.AreEqual(updatedPaymentResults.Any(q => q.ClaimId != 0), actual.Any(q => q.ClaimId != 0));
        }
        public void UpdateAdjudicatedAmountIfPaymentResultNull()
        {
            _mockPaymentResultLogic = new Mock <IPaymentResultRepository>();
            var paymentResults = new List <PaymentResult>
            {
                new PaymentResult {
                    ClaimId = 123, Line = 1, ServiceTypeId = 10
                },
                new PaymentResult {
                    ClaimId = 123, Line = 1, ServiceTypeId = 5
                }
            };
            var mockContractServiceTypeLogic = new Mock <IContractServiceTypeLogic>();
            var mockPaymentResultLogic       = new Mock <IPaymentResultLogic>();

            mockPaymentResultLogic.Setup(
                x =>
                x.Evaluate(It.IsAny <EvaluateableClaim>(), It.IsAny <List <PaymentResult> >(), It.IsAny <bool>(),
                           It.IsAny <bool>())).Returns(paymentResults);
            _target = new PaymentResultLogic(_mockPaymentResultLogic.Object);
            IEvaluateableClaim evaluateableClaim = new EvaluateableClaim();

            evaluateableClaim.ClaimId      = 123;
            evaluateableClaim.ClaimCharges = new List <ClaimCharge>
            {
                new ClaimCharge
                {
                    Line    = 1,
                    Amount  = 20,
                    RevCode = "250"
                }
            };
            var updatedPaymentResults = new List <PaymentResult>
            {
                new PaymentResult {
                    ClaimId = 123, Line = 1, ServiceTypeId = 10
                },
                new PaymentResult {
                    ClaimId = 123, Line = 1, ServiceTypeId = 5
                }
            };

            var mockContractBaseLogic = new Mock <ContractBaseLogic>();

            mockContractServiceTypeLogic.Setup(x => x.Evaluate(evaluateableClaim, paymentResults, false, false))
            .Returns(updatedPaymentResults);
            mockContractBaseLogic.SetupAllProperties();


            //Act
            List <PaymentResult> actual = _target.Evaluate(evaluateableClaim, paymentResults, false, false);

            // Assert
            Assert.AreEqual(true, actual.TrueForAll(q => q.AdjudicatedValue == null));
        }
        public void GetPaymentResultsIfClaimNotNull()
        {
            _mockPaymentResultLogic = new Mock <IPaymentResultRepository>();
            var paymentResults = new List <PaymentResult>
            {
                new PaymentResult {
                    ClaimId = 123, AdjudicatedValue = 100, ContractId = 101
                },
                new PaymentResult {
                    ClaimId = 123, ContractId = 101
                }
            };
            var mockPaymentResultLogic = new Mock <IPaymentResultLogic>();

            mockPaymentResultLogic.Setup(
                x =>
                x.Evaluate(It.IsAny <EvaluateableClaim>(), It.IsAny <List <PaymentResult> >(), It.IsAny <bool>(),
                           It.IsAny <bool>())).Returns(paymentResults);
            _target = new PaymentResultLogic(_mockPaymentResultLogic.Object);
            var evaluateableClaim = new EvaluateableClaim
            {
                ClaimId      = 123,
                ClaimCharges = new List <ClaimCharge>
                {
                    new ClaimCharge
                    {
                        Line    = 1,
                        Amount  = 20,
                        RevCode = "250"
                    }
                }
            };

            //Act
            List <PaymentResult> actual = _target.GetPaymentResults(evaluateableClaim);

            // Assert
            Assert.AreEqual(evaluateableClaim.ClaimCharges[0].Amount, actual[1].ClaimTotalCharges);
        }
 public void PaymentResultLogicRepositoryConstructorUnitTest()
 {
     _mockPaymentResultLogic = new Mock <IPaymentResultRepository>();
     _target = new PaymentResultLogic(_mockPaymentResultLogic.Object);
     Assert.IsInstanceOfType(_target, typeof(PaymentResultLogic));
 }
 public void PaymentResultLogicParameterlessConstructorTest()
 {
     _target = new PaymentResultLogic(Constants.ConnectionString);
     //Assert
     Assert.IsInstanceOfType(_target, typeof(PaymentResultLogic));
 }