コード例 #1
0
        public void TestReadSpecialPlacementFilterEol()
        {
            var service = SystemUnderTest();

            var startDate = DateTime.Now.Date;
            var endDate   = DateTime.Now.AddDays(20);

            var response = new SpecialPlacementHistoryListResponse()
            {
                ListItems = new[] { new SpecialPlacementHistoryListItem()
                                    {
                                        StartDate = startDate, EndDate = endDate, CircumCd = "EOL1"
                                    } }
            };
            var mappedModel = MappingEngine.Map <JobseekerModel>(response);

            // define how the mapping will happen
            _mockMappingEngine.Setup(x => x.Map <RegistrationDetailsReadAllRequest>(It.IsAny <long>())).Returns(new RegistrationDetailsReadAllRequest()
            {
                ApplicationName = "UES", JobSeekerId = 123
            });
            _mockMappingEngine.Setup(x => x.Map <JobseekerModel>(It.IsAny <SpecialPlacementHistoryListResponse>())).Returns(mappedModel);
            // define how adw will work.
            _mockAdwService.Setup(x => x.GetRelatedCodes("EOLO")).Returns(new[] { new RelatedCodeModel {
                                                                                      SubordinateCode = "EOL1"
                                                                                  }, new RelatedCodeModel {
                                                                                      SubordinateCode = "EOL2"
                                                                                  } });
            // define the 'wcf' call
            _mockSpecialPlacementWcf.Setup(
                call => call.GetSpecialPlacementHistoryList(It.IsAny <SpecialPlacementHistoryListRequest>()))
            .Returns(new SpecialPlacementHistoryListResponse()
            {
                ListItems = new[] { new SpecialPlacementHistoryListItem()
                                    {
                                        StartDate = startDate, EndDate = endDate, CircumCd = "EOL1"
                                    } }
            });

            _mockRegWcf.Setup(
                call => call.GetAll(It.IsAny <RegistrationDetailsReadAllRequest>()))
            .Returns(new RegistrationDetailsReadAllResponse());


            //var modelResponse = service.ReadSpecialPlacements(123, true, string.Empty);
            //var items = new List<SpecialPlacementModel>(modelResponse.HistoryItems);
            //// here we are testing that the filter is working.
            //Assert.IsTrue(items.Count == 0);

            //modelResponse = service.ReadSpecialPlacements(123, false, string.Empty);
            //items = new List<SpecialPlacementModel>(modelResponse.HistoryItems);
            //// here we are testing that the filter is working.
            //Assert.IsTrue(items.Count == 0);

            var modelResponse = service.ReadSpecialPlacements(123);
            var items         = new List <SpecialPlacementModel>(modelResponse.SpecialPlacements);

            // here we are testing that the filter is working.
            Assert.IsTrue(items.Count == 1);
        }
コード例 #2
0
        public void TestReadSpecialPlacements()
        {
            var service = SystemUnderTest();

            var startDate = DateTime.Now.Date;
            var endDate   = DateTime.Now.AddDays(20);

            var response = new SpecialPlacementHistoryListResponse()
            {
                ListItems = new[] { new SpecialPlacementHistoryListItem()
                                    {
                                        StartDate = startDate, EndDate = endDate, CircumCd = "EOL1"
                                    } }
            };
            var mappedModel = MappingEngine.Map <JobseekerModel>(response);

            var request = MappingEngine.Map <RegistrationDetailsReadAllRequest>((long)123);

            _mockMappingEngine.Setup(m => m.Map <RegistrationDetailsReadAllRequest>((long)123)).Returns(request);

            // define how the mapping will happen
            _mockMappingEngine.Setup(x => x.Map <JobseekerModel>(It.IsAny <SpecialPlacementHistoryListResponse>())).Returns(mappedModel);
            // define how adw will work.
            _mockAdwService.Setup(x => x.GetRelatedCodes("EOLO")).Returns(new[] { new RelatedCodeModel {
                                                                                      SubordinateCode = "EOL1"
                                                                                  }, new RelatedCodeModel {
                                                                                      SubordinateCode = "EOL2"
                                                                                  } });
            _mockRegWcf.Setup(
                call => call.GetAll(It.IsAny <RegistrationDetailsReadAllRequest>()))
            .Returns(new RegistrationDetailsReadAllResponse());
            // define the 'wcf' call
            _mockSpecialPlacementWcf.Setup(
                call => call.GetSpecialPlacementHistoryList(It.IsAny <SpecialPlacementHistoryListRequest>()))
            .Returns(new SpecialPlacementHistoryListResponse()
            {
                ListItems = new[] { new SpecialPlacementHistoryListItem()
                                    {
                                        StartDate = startDate, EndDate = endDate, CircumCd = "EOL1"
                                    } }
            });

            var modelResponse = service.ReadSpecialPlacements(123);

            Assert.IsNotNull(modelResponse);
        }