示例#1
0
        public void OutletUpdateNEIS_WcfThrowsFaultException_ThrowsServiceValidationException()
        {
            var exception = IesContractTestDataHelper.CreateDummyFaultException();

            //1. Setup data
            //a.request
            IesOutletUpdateNEISRequestModel request = new IesOutletUpdateNEISRequestModel
            {
                CheckRelatedOutletFlag = "N",
                ContactName            = "TBA",
                ContractId             = "0205881K",
                EmailAddress           = null,
                EndDate   = new DateTime(2015, 6, 30),
                FaxNumber = null,
                IntegrityControlNumber = 118,
                MobileNumber           = null,
                PhoneNumber            = "0123456789",
                ProviderText           = "abc",
                RelatedOutlets         = null,
                SequenceNumber         = 1,
                StartDate           = new DateTime(2009, 4, 2),
                SupervisingOffice   = "QLPU",
                SuspendRefsFromDate = DateTime.MinValue
            };

            mockOutletUpdateWcf.Setup(m => m.UpdateOutletNEIS(It.IsAny <OutletUpdateNEISRequest>())).Throws(exception);

            //2. exec
            var result = SystemUnderTest().UpdateOutletNEIS(request);
        }
示例#2
0
        public void OutletUpdateNEIS_Valid()
        {
            //1. Setup data
            //a.request


            IesOutletUpdateNEISRequestModel request = new IesOutletUpdateNEISRequestModel
            {
                CheckRelatedOutletFlag = "N",
                ContactName            = "TBA",
                ContractId             = "0205881K",
                EmailAddress           = null,
                EndDate   = new DateTime(2015, 6, 30),
                FaxNumber = null,
                IntegrityControlNumber = 118,
                MobileNumber           = null,
                PhoneNumber            = "0123456789",
                ProviderText           = "abc",
                RelatedOutlets         = null,
                SequenceNumber         = 1,
                StartDate           = new DateTime(2009, 4, 2),
                SupervisingOffice   = "QLPU",
                SuspendRefsFromDate = DateTime.MinValue
            };
            //b.response

            var response = new OutletUpdateNEISResponse
            {
                IntegrityControlNumber = 119,
                SequenceNumber         = 1,
                UpdateDate             = DateTime.Today,
                UpdateTime             = DateTime.Now,
                UpdateUserId           = "test"
            };

            mockOutletUpdateWcf.Setup(m => m.UpdateOutletNEIS(It.IsAny <OutletUpdateNEISRequest>())).Returns(response);

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

            //3. Verification
            Assert.AreEqual(response.IntegrityControlNumber, result.IntegrityControlNumber);
            Assert.AreEqual(response.SequenceNumber, result.SequenceNumber);
            Assert.AreEqual(response.UpdateUserId, result.UpdateUserId);
            Assert.AreEqual(response.UpdateDate, result.UpdateDate);
            Assert.AreEqual(response.UpdateTime, result.UpdateTime);

            //Verify behaviour
            mockOutletUpdateWcf.Verify(m => m.UpdateOutletNEIS(It.Is <OutletUpdateNEISRequest>(r => r.ContractId + r.SequenceNumber.ToString() == request.ContractId + request.SequenceNumber.ToString())), Times.Once());
        }
示例#3
0
        public void IesOutletUpdateNEISRequestModelToOutletUpdateNEISRequest_MappingTest_Valid()
        {
            //1. setup data
            IesOutletUpdateNEISRequestModel source = new IesOutletUpdateNEISRequestModel
            {
                CheckRelatedOutletFlag = "y",
                ContactName            = "ContactName",
                ContractId             = "0123456789H",
                EmailAddress           = "*****@*****.**",
                EndDate   = DateTime.Now,
                FaxNumber = "88888888",
                IntegrityControlNumber = 100,
                MobileNumber           = "04000004",
                PhoneNumber            = "99999999",
                ProviderText           = "ProviderText",
                RelatedOutlets         = new IesOutletRelatedInModel[] { new IesOutletRelatedInModel {
                                                                             ContractId = "121212128H", IntegrityControlNumber = 200, SequenceNumber = 1
                                                                         } },
                SequenceNumber      = 1,
                StartDate           = DateTime.Now.AddYears(-1),
                SupervisingOffice   = "SupervisingOffice",
                SuspendRefsFromDate = DateTime.Now.AddDays(-4)
            };


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

            //3. Verification
            Assert.AreEqual(source.CheckRelatedOutletFlag, dest.CheckRelatedOutletFlag);
            Assert.AreEqual(source.ContactName, dest.ContactName);
            Assert.AreEqual(source.ContractId, dest.ContractId);
            Assert.AreEqual(source.EmailAddress, dest.EmailAddress);
            Assert.AreEqual(source.EndDate, dest.EndDate);
            Assert.AreEqual(source.FaxNumber, dest.FaxNumber);
            Assert.AreEqual(source.IntegrityControlNumber, dest.IntegrityControlNumber);
            Assert.AreEqual(source.MobileNumber, dest.MobileNumber);
            Assert.AreEqual(source.PhoneNumber, dest.PhoneNumber);
            Assert.AreEqual(source.ProviderText, dest.ProviderText);
            Assert.AreEqual(source.RelatedOutlets.Length, dest.RelatedOutlets.Length);
            Assert.AreEqual(source.SequenceNumber, dest.SequenceNumber);
            Assert.AreEqual(source.StartDate, dest.StartDate);
            Assert.AreEqual(source.SupervisingOffice, dest.SupervisingOffice);
            Assert.AreEqual(source.SuspendRefsFromDate, dest.SuspendRefsFromDate);
        }