public void PaymentTypePerVisitDiscountConstructor2()
        {
            var mockProductRepository       = new Mock <IPaymentTypePerVisitRepository>();
            PaymentTypePerVisitLogic target = new PaymentTypePerVisitLogic(mockProductRepository.Object);

            Assert.IsInstanceOfType(target, typeof(PaymentTypePerVisitLogic));
        }
        public void PaymentTypePerVisitConstructor()
        {
            var target = new PaymentTypePerVisitLogic(Constants.ConnectionString);

            //Assert
            Assert.IsInstanceOfType(target, typeof(PaymentTypePerVisitLogic));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="PaymentTypePerVisitController"/> class.
        /// </summary>
        public PaymentTypePerVisitController()
        {
            int    facilityId       = Convert.ToInt32(System.Web.HttpContext.Current.Request.Headers[Constants.BubbleDataSource]);
            string bubbleDataSource = GetFacilityConnection(facilityId);

            _paymentTypePerVisitDetailsLogic = new PaymentTypePerVisitLogic(bubbleDataSource);
        }
        public void EditPaymentTypePerVisitDetailsIfNull()
        {
            var mockProductRepository = new Mock <IPaymentTypePerVisitRepository>();

            mockProductRepository.Setup(f => f.AddEditPaymentTypePerVisitDetails(It.IsAny <PaymentTypePerVisit>())).Returns(0);
            PaymentTypePerVisitLogic target = new PaymentTypePerVisitLogic(mockProductRepository.Object);
            long actual = target.AddEditPaymentType(null);

            Assert.IsNotNull(actual);
            Assert.AreEqual(0, actual);
        }
        public void GetPaymentTypePerVisitDetailsMockTestIsNull()
        {
            var mockProductRepository = new Mock <IPaymentTypePerVisitRepository>();

            mockProductRepository.Setup(f => f.GetPaymentTypePerVisitDetails(It.IsAny <PaymentTypePerVisit>())).Returns((PaymentTypePerVisit)null);
            PaymentTypePerVisitLogic target = new PaymentTypePerVisitLogic(mockProductRepository.Object);
            PaymentTypePerVisit      actual = (PaymentTypePerVisit)target.GetPaymentType(null);

            Assert.IsNull(actual);
            // Assert.IsNotNull(actual);
        }
        public void GetPaymentTypePerVisitDetailsMockTestIsNotNull()
        {
            PaymentTypePerVisit objPaymentTypeVisit = new PaymentTypePerVisit {
                PaymentTypeId = 1
            };
            var mockProductRepository = new Mock <IPaymentTypePerVisitRepository>();

            mockProductRepository.Setup(f => f.GetPaymentTypePerVisitDetails(It.IsAny <PaymentTypePerVisit>())).Returns(objPaymentTypeVisit);
            PaymentTypePerVisitLogic target = new PaymentTypePerVisitLogic(mockProductRepository.Object);
            PaymentTypePerVisit      actual = (PaymentTypePerVisit)target.GetPaymentType(objPaymentTypeVisit);

            Assert.AreEqual(1, actual.PaymentTypeId);
        }
        public void AddNewPaymentTypePerVisitDetailsIfNotNull()
        {
            var mockProductRepository = new Mock <IPaymentTypePerVisitRepository>();

            mockProductRepository.Setup(f => f.AddEditPaymentTypePerVisitDetails(It.IsAny <PaymentTypePerVisit>())).Returns(2);
            PaymentTypePerVisitLogic target = new PaymentTypePerVisitLogic(mockProductRepository.Object);
            PaymentTypePerVisit      objPaymentTypePerVisit = new PaymentTypePerVisit {
                PaymentTypeDetailId = 1
            };
            long actual = target.AddEditPaymentType(objPaymentTypePerVisit);

            // Assert.IsNull(actual);
            Assert.AreEqual(2, actual);
            //  Assert.IsTrue(actual.Equals(null));
        }
        public void EvaluateAtClaimLevelTest()
        {
            List <PaymentResult> paymentResults = new List <PaymentResult>
            {
                new PaymentResult {
                    ClaimId = 123, Line = 1, AdjudicatedValue = null
                },
                new PaymentResult {
                    ClaimId = 123, Line = 2, AdjudicatedValue = null
                },
            };
            PaymentTypePerVisit paymentTypePerVisit = new PaymentTypePerVisit
            {
                Rate            = 10,
                PayAtClaimLevel = true,
                ValidLineIds    = new List <int> {
                    1, 2, 3, 4, 5, 6
                },
                Conditions = new List <ICondition>
                {
                    new Condition
                    {
                        ConditionOperator = (byte)Enums.ConditionOperation.EqualTo,
                        LeftOperands      = new List <string> {
                            "300"
                        },
                        OperandType  = (byte)Enums.OperandIdentifier.HcpcsCode,
                        RightOperand = "300"
                    }
                },
                ContractId = 1,
                HcpcsCode  = "300",
            };
            // Arrange
            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);
            Mock <IPaymentTypePerVisitRepository> paymentTypePerVisitRepository = new Mock <IPaymentTypePerVisitRepository>();

            paymentTypePerVisitRepository.Setup(x => x.GetPaymentTypePerVisitDetails(It.IsAny <PaymentTypePerVisit>()))
            .Returns(paymentTypePerVisit);

            var target = new PaymentTypePerVisitLogic(paymentTypePerVisitRepository.Object)
            {
                PaymentTypeBase = paymentTypePerVisit
            };


            // _target.Contract = contract;
            IEvaluateableClaim evaluateableClaim = new EvaluateableClaim();

            evaluateableClaim.ClaimId      = 123;
            evaluateableClaim.ClaimTotal   = 100;
            evaluateableClaim.ClaimCharges = new List <ClaimCharge>
            {
                new ClaimCharge
                {
                    Line      = 1,
                    Amount    = 20,
                    HcpcsCode = "300"
                },
                new ClaimCharge
                {
                    Line      = 2,
                    Amount    = 20,
                    HcpcsCode = "301"
                },
                new ClaimCharge
                {
                    Line      = 3,
                    Amount    = 20,
                    HcpcsCode = "302"
                },
                new ClaimCharge
                {
                    Line      = 4,
                    Amount    = 20,
                    HcpcsCode = "303"
                },
                new ClaimCharge
                {
                    Line      = 5,
                    Amount    = 20,
                    HcpcsCode = "304"
                },
                new ClaimCharge
                {
                    Line      = 6,
                    Amount    = 20,
                    HcpcsCode = "305"
                }
            };


            List <PaymentResult> updatedPaymentResults = new List <PaymentResult>
            {
                new PaymentResult {
                    ClaimId = 123, ContractId = 1, AdjudicatedValue = 110
                },
                new PaymentResult {
                    ClaimId = 123, Line = 1, ContractId = 1, AdjudicatedValue = 110
                }
            };

            Mock <ContractBaseLogic> mockContractBaseLogic = new Mock <ContractBaseLogic>();

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

            //Act
            List <PaymentResult> actual = target.EvaluatePaymentType(evaluateableClaim, paymentResults, true, false);

            // Assert
            Assert.AreEqual(3, actual.Count);
            var firstOrDefault = paymentResults.FirstOrDefault(x => x.AdjudicatedValue != null);

            if (firstOrDefault != null)
            {
                Assert.AreEqual(10, firstOrDefault.AdjudicatedValue);
            }
        }