コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ContractAlertController"/> class.
        /// </summary>
        public ContractAlertController()
        {
            int    facilityId       = Convert.ToInt32(System.Web.HttpContext.Current.Request.Headers[Constants.BubbleDataSource]);
            string bubbleDataSource = GetFacilityConnection(facilityId);

            _contarctAlertsLogic = new ContractAlertLogic(bubbleDataSource);
        }
コード例 #2
0
        public void ContarctAlertsLogicConstructorTest1()
        {
            Mock <IContractAlertRepository> mockProductRepository = new Mock <IContractAlertRepository>();
            ContractAlertLogic target = new ContractAlertLogic(mockProductRepository.Object);

            Assert.IsInstanceOfType(target, typeof(ContractAlertLogic));
        }
コード例 #3
0
        public void GetContractAlertsNullTest()
        {
            var repository = new Mock <IContractAlertRepository>();

            repository.Setup(f => f.GetContractAlerts(null));
            ContractAlertLogic target = new ContractAlertLogic(repository.Object);

            List <ContractAlert> actual = target.GetContractAlerts(null);

            Assert.AreEqual(null, actual);
        }
コード例 #4
0
        public void UpdateContractAlertsIfNullTest()
        {
            var repository = new Mock <IContractAlertRepository>();

            repository.Setup(f => f.UpdateContractAlerts(null));
            ContractAlertLogic target = new ContractAlertLogic(repository.Object);

            bool actual = target.UpdateContractAlerts(null);

            Assert.AreEqual(false, actual);
        }
コード例 #5
0
        public void UpdateContractAlertsMockTest1()
        {
            Mock <IContractAlertRepository> mockContractAlertsRepository = new Mock <IContractAlertRepository>();
            ContractAlert objContractAlert = new ContractAlert {
                ContractId = 1
            };

            mockContractAlertsRepository.Setup(f => f.UpdateContractAlerts(objContractAlert)).Returns(true);
            ContractAlertLogic target = new ContractAlertLogic(mockContractAlertsRepository.Object);
            bool actual = target.UpdateContractAlerts(objContractAlert);

            Assert.AreEqual(true, actual);
        }
コード例 #6
0
        public void GetContractAlertsMockTest()
        {
            //Mock input
            ContractAlert contractAlertList = new ContractAlert
            {
                UserName = "******"
            };
            //Mock output
            List <ContractAlert> test = new List <ContractAlert>
            {
                new ContractAlert
                {
                    PayerName    = "BCBS AL",
                    ContractName = "Maha testing #2013-13",
                    ContractId   = 1526,
                    DateOfExpiry = new DateTime(11 / 7 / 2013),
                },

                new ContractAlert
                {
                    PayerName    = "AETNA",
                    ContractName = "Ragini Test123 #2013-13",
                    ContractId   = 1533,
                    DateOfExpiry = new DateTime(10 / 9 / 2013),
                },
                new ContractAlert
                {
                    PayerName    = "BCBS AL",
                    ContractName = "Copy Of Maha testing #2013-13",
                    ContractId   = 1540,
                    DateOfExpiry = new DateTime(11 / 7 / 2013),
                },
                new ContractAlert
                {
                    PayerName    = "AETNA",
                    ContractName = "Copy Of Ragini Test123 #2013-13",
                    ContractId   = 1544,
                    DateOfExpiry = new DateTime(10 / 9 / 2013),
                },
            };
            List <ContractAlert> expected = test;
            //Mock setup
            Mock <IContractAlertRepository> mockProductRepository = new Mock <IContractAlertRepository>();

            mockProductRepository.Setup(f => f.GetContractAlerts(It.IsAny <ContractAlert>())).Returns(test);
            ContractAlertLogic   target = new ContractAlertLogic(mockProductRepository.Object);
            List <ContractAlert> actual = target.GetContractAlerts(contractAlertList);

            Assert.AreEqual(expected, actual);
        }
コード例 #7
0
        public void UpdateContractAlertsIfNotNullTest()
        {
            //Arrange
            var           repository = new Mock <IContractAlertRepository>();
            ContractAlert value      = new ContractAlert();

            repository.Setup(f => f.UpdateContractAlerts(It.IsAny <ContractAlert>())).Returns(true);
            ContractAlertLogic target = new ContractAlertLogic(repository.Object);

            //Act
            bool actual = target.UpdateContractAlerts(value);

            //Assert
            Assert.AreEqual(true, actual);
        }
コード例 #8
0
        public void ContarctAlertsLogicConstructorTest()
        {
            ContractAlertLogic target = new ContractAlertLogic(Constants.ConnectionString);

            Assert.IsInstanceOfType(target, typeof(ContractAlertLogic));
        }