Esempio n. 1
0
        public void ContractList_Valid()
        {
            //1. Setup data
            //a.request
            var request = IesContractTestDataHelper.CreateDummyContractListModel();
            //b.response
            List <OutContractSearchGroup> contractLists = new List <OutContractSearchGroup>();

            for (int i = 1; i < 10; i++)
            {
                contractLists.Add(IesContractTestDataHelper.CreateDummyContract(i));
            }

            var response = new ContractSearchResponse
            {
                MoreFlag         = "Y",
                NextContractId   = "123456789A",
                OutContractGroup = contractLists.ToArray()
            };

            mockContractSearchWcf.Setup(m => m.ContractSearch(It.IsAny <ContractSearchRequest>())).Returns(response);

            //2. exec
            var result = SystemUnderTest().ListContracts(request);

            //3. Verification
            //Verify More parameters
            Assert.AreEqual(true, result.HasMoreRecords);
            Assert.AreEqual(response.NextContractId, result.NextContractId);
            //Verify response list
            Assert.AreEqual(response.OutContractGroup.Length, result.Results.Count());

            //Verify behaviour
            mockContractSearchWcf.Verify(m => m.ContractSearch(It.Is <ContractSearchRequest>(r => r.ContractType == request.ContractType)), Times.Once());
        }
Esempio n. 2
0
        public void ContractList_WcfThrowsFaultException_ThrowsServiceValidationException()
        {
            var exception = IesContractTestDataHelper.CreateDummyFaultException();

            //1. Setup data
            //a.request
            var request = IesContractTestDataHelper.CreateDummyContractListModel();

            mockContractSearchWcf.Setup(m => m.ContractSearch(It.IsAny <ContractSearchRequest>())).Throws(exception);

            //2. exec
            var result = SystemUnderTest().ListContracts(request);
        }
Esempio n. 3
0
        public void ContractList_FailedResponse_ThrowsServiceValidationException()
        {
            //1. Setup data
            //a.request
            var request = IesContractTestDataHelper.CreateDummyContractListModel();

            //b.response
            var response = new ContractSearchResponse();

            response.ExecutionResult = IesContractTestDataHelper.CreateDummyFailedExecutionResult();

            mockContractSearchWcf.Setup(m => m.ContractSearch(It.IsAny <ContractSearchRequest>())).Returns(response);

            //2. exec
            var result = SystemUnderTest().ListContracts(request);

            //3. Verification
        }
Esempio n. 4
0
        public void ContractListModelToContractSearchRequestMapper_MappingTest_Valid()
        {
            //1. setup data
            var source = IesContractTestDataHelper.CreateDummyContractListModel();

            //2. Exec
            var dest = MappingEngine.Map <ContractSearchRequest>(source);

            //3. Verification
            Assert.AreEqual(source.AccountManagingOffice, dest.AccountManagingOffice);
            Assert.AreEqual(source.ActivityId, dest.ActivityId);
            Assert.AreEqual(source.ContractEndDateFrom, dest.ContractEndDateFrom);
            Assert.AreEqual(source.ContractEndDateTo, dest.ContractEndDateTo);
            Assert.AreEqual(source.ContractRound, dest.ContractRound);
            Assert.AreEqual(source.ContractStartDateFrom, dest.ContractStartDateFrom);
            Assert.AreEqual(source.ContractStartDateTo, dest.ContractStartDateTo);
            Assert.AreEqual(source.ContractStatus, dest.ContractStatus);
            Assert.AreEqual(source.ContractType, dest.ContractType);
            Assert.AreEqual(source.OrganisationCode, dest.Organisation);
            Assert.AreEqual(source.ProviderId, dest.ProviderId);
        }