Example #1
0
        public void ESL_History_throw_FaultException_ThrowsServiceValidationException()
        {
            // Arrange
            var exception = new FaultException(new FaultReason("reason"), new FaultCode("code"));
            var eslModel  = new EarlySchoolLeaverModel {
                AdvisedDate = DateTime.Now, EducationLevel = "Year 12 attended", EventDate = DateTime.Now.AddMonths(11), Y12 = "Not Varified"
            };

            mockMappingEngine.Setup(m => m.Map <ESLHistoryRequest>(It.IsAny <long>())).Returns(new ESLHistoryRequest());
            mockRegWcf.Setup(m => m.List(It.IsAny <ESLHistoryRequest>())).Throws(exception);
            mockMappingEngine.Setup(m => m.Map <IEnumerable <EarlySchoolLeaverModel> >(It.IsAny <IEnumerable <ESLHistoryItem> >())).Returns(new List <EarlySchoolLeaverModel> {
                eslModel
            });
            //Act
            var result = SystemUnderTest().ReadESLHistory((long)3187026003);
        }
Example #2
0
        public void ESL_History_Successful_Test()
        {
            // Arrange
            var eslModel = new EarlySchoolLeaverModel {
                AdvisedDate = DateTime.Now, EducationLevel = "Year 12 attended", EventDate = DateTime.Now.AddMonths(11), Y12 = "Not Varified"
            };

            mockMappingEngine.Setup(m => m.Map <ESLHistoryRequest>(It.IsAny <long>())).Returns(new ESLHistoryRequest());
            mockRegWcf.Setup(m => m.List(It.IsAny <ESLHistoryRequest>())).Returns(new ESLHistoryResponse());
            mockMappingEngine.Setup(m => m.Map <IEnumerable <EarlySchoolLeaverModel> >(It.IsAny <IEnumerable <ESLHistoryItem> >())).Returns(new List <EarlySchoolLeaverModel> {
                eslModel
            });
            //Act
            var result = SystemUnderTest().ReadESLHistory((long)3187026003);

            //Assert
            mockRegWcf.Verify(m => m.List(It.IsAny <ESLHistoryRequest>()), Times.Once());
            mockMappingEngine.Verify(m => m.Map <ESLHistoryRequest>((long)3187026003), Times.Once());
        }