public void SelectContractModelLogicConstructorTest1()
        {
            var mockSelectContractModelRepository = new Mock <ISelectContractModelRepository>();
            SelectContractModelLogic target       = new SelectContractModelLogic(mockSelectContractModelRepository.Object);

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

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

            _selectContractModelLogic = new SelectContractModelLogic(bubbleDataSource);
        }
        public void GetAllContractFacilitiesTest()
        {
            var mockSelectContractModelRepository = new Mock <ISelectContractModelRepository>();
            List <FacilityDetail> result          = new List <FacilityDetail>
            {
                new FacilityDetail {
                    FacilityName = "Facility1", NodeId = 1
                }
            };

            mockSelectContractModelRepository.Setup(f => f.GetAllContractFacilities(It.IsAny <ContractHierarchy>()))
            .Returns(result);
            SelectContractModelLogic target = new SelectContractModelLogic(mockSelectContractModelRepository.Object);

            //Act
            List <FacilityDetail> actual = target.GetAllContractFacilities(null);

            //Assert
            Assert.AreEqual(actual, result);
        }
        public void GetAllContractModelsTest()
        {
            Mock <ISelectContractModelRepository> mockSelectContractModelRepository = new Mock <ISelectContractModelRepository>();
            SelectContractModelLogic target   = new SelectContractModelLogic(mockSelectContractModelRepository.Object);
            List <ContractModel>     expected = new List <ContractModel> {
                new ContractModel {
                    FacilityId = 0
                }
            };

            mockSelectContractModelRepository.Setup(f => f.GetAllContractModels(It.IsAny <ContractModel>()))
            .Returns(expected);
            const int            facilityId = 0;
            List <ContractModel> actual     = target.GetAllContractModels(new ContractModel {
                FacilityId = facilityId
            });

            Assert.AreEqual(expected, actual);

            //Assert
            //Assert.AreEqual(result, actual);
        }
        public void GetAllContractModelsUnitTestIfNotNull()
        {
            //Mock Input
            const int contractId = 354;

            //Mock output
            List <ContractModel> result = new List <ContractModel> {
                new ContractModel {
                    NodeId = 976
                },
                new ContractModel {
                    NodeId = 976
                }
            };
            var mockGetAllContractModels = new Mock <ISelectContractModelRepository>();

            mockGetAllContractModels.Setup(f => f.GetAllContractModels(It.IsAny <ContractModel>())).Returns(result);
            SelectContractModelLogic target = new SelectContractModelLogic(mockGetAllContractModels.Object);
            List <ContractModel>     actual = target.GetAllContractModels(new ContractModel {
                FacilityId = contractId
            });

            Assert.AreEqual(result, actual);
        }