public void ContractSearchResponseToContractListModel_MappingTest_Valid() { //1. setup data List <OutContractSearchGroup> contractList = new List <OutContractSearchGroup>(); for (int i = 1; i < 10; i++) { contractList.Add(IesContractTestDataHelper.CreateDummyContract(i)); } var source = new ContractSearchResponse { MoreFlag = "Y", NextContractId = "123456789A", OutContractGroup = contractList.ToArray(), }; //2. Exec var dest = MappingEngine.Map <IesContractListModel>(source); //3. Verification //Verify More parameters Assert.AreEqual(true, dest.HasMoreRecords); Assert.AreEqual(source.NextContractId, dest.NextContractId); //Verify response list Assert.AreEqual(source.OutContractGroup.Length, dest.Results.Count()); }
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()); }
public void ContractGroupToIesContractModel_MappingTest_Valid() { //1. setup data var source = IesContractTestDataHelper.CreateDummyContract(8); //2. Exec var dest = MappingEngine.Map <IesContractModel>(source); //3. Verification Assert.AreEqual(source.AccountManagingOffice, dest.AccountManagingOffice); Assert.AreEqual(source.ContractEndDate, dest.ContractEndDate); Assert.AreEqual(source.ContractId, dest.ContractId); Assert.AreEqual(source.ContractIdDescription, dest.ContractDescription); Assert.AreEqual(source.ContractStatus, dest.ContractStatus); Assert.AreEqual(source.ContractType, dest.ContractType); Assert.AreEqual(source.OrganisationCode, dest.OrganisationCode); Assert.AreEqual(source.RegionArea, dest.RegionArea); Assert.AreEqual(source.Specialisation, dest.Specialisation); }