Exemple #1
0
        public void OutletSearchResponseToOutlettListModel_MappingTest_Valid()
        {
            //1. setup data
            List <OutOutletSearchGroup> outletList = new List <OutOutletSearchGroup>();

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

            var source = new OutletSearchResponse
            {
                MoreFlag           = "Y",
                NextContractId     = "123456789A",
                OutOutletGroup     = outletList.ToArray(),
                NextSequenceNumber = 1
            };

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

            //3. Verification
            //Verify More parameters
            Assert.AreEqual(true, dest.HasMoreRecords);
            Assert.AreEqual(source.NextContractId, dest.NextContractId);
            //Verify response list
            Assert.AreEqual(source.OutOutletGroup.Length, dest.Results.Count());
        }
Exemple #2
0
        public void OutletGroupToIesOutletModel_MappingTest_Valid()
        {
            //1. setup data
            var source = IesContractTestDataHelper.CreateDummyOutlet(8);

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

            //3. Verification
            Assert.AreEqual(source.ContractID, dest.ContractId);
            Assert.AreEqual(source.Description, dest.Description);
            Assert.AreEqual(source.EndDate, dest.OutletEndDate);
            Assert.AreEqual(source.SequenceNumber, dest.SequenceNumber);
            Assert.AreEqual(source.Services, dest.Services);
            Assert.AreEqual(source.SiteCode, dest.SiteCode);
            Assert.AreEqual(source.Status, dest.OutletStatus);
        }
Exemple #3
0
        public void OutletList_Valid()
        {
            //1. Setup data
            //a.request
            var request = IesContractTestDataHelper.CreateDummyOutletListModel();
            //b.response
            List <OutOutletSearchGroup> outletList = new List <OutOutletSearchGroup>();

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

            var response = new OutletSearchResponse
            {
                MoreFlag           = "Y",
                NextContractId     = "123456789A",
                OutOutletGroup     = outletList.ToArray(),
                NextSequenceNumber = 1
            };

            mockContractSearchWcf.Setup(m => m.OutletSearch(It.IsAny <OutletSearchRequest>())).Returns(response);

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

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

            //Verify behaviour
            mockContractSearchWcf.Verify(m => m.OutletSearch(It.Is <OutletSearchRequest>(r => r.ContractType == request.ContractType)), Times.Once());
        }