public void When_Search_Then_map_returned_entities_to_dtos()
        {
            //given
            var actions = new List<BusinessSafe.Domain.Entities.Action>()
                                  {                      
                                        new BusinessSafe.Domain.Entities.Action()
                                        {
                                            Id = 123123,
                                            Title = "test title",
                                            AreaOfNonCompliance = "area not compliant",
                                            ActionRequired = "action required test",                        
                                            TargetTimescale = "do this now",
                                            AssignedTo = new Employee(){Id = Guid.NewGuid(), Forename = "Fred", Surname = "Flintstone"},
                                            DueDate = DateTime.Now.AddDays(10),
                                            Reference = "The Reference",
                                            Category = ActionCategory.Action
                                        }
                                  };


            var target = GetTarget();

            _actionRepository.Setup(x => x.GetAll()).Returns(actions);

            //when
            SearchActionRequest request = new SearchActionRequest()
            {
                ActionPlanId = 123123L
            };
            var result = target.Search(request);

            //then
            Assert.That(result.FirstOrDefault().Id, Is.EqualTo(actions.FirstOrDefault().Id));
            Assert.That(result.FirstOrDefault().Title, Is.EqualTo(actions.FirstOrDefault().Title));                   
        }
        public void When_Search_Then_map_request_to_repository_call()
        {
            //given
            var target = GetTarget();

            //when
            SearchActionRequest request = new SearchActionRequest()
                                              {
                                                  ActionPlanId = 123L
                                              };
            target.Search(request);

            //then
            _actionRepository.Verify(x => x.GetAll());
        }
Example #3
0
 public IEnumerable<ActionDto> Search(SearchActionRequest request)
 {
     var actions = _actionRepository.GetAll();
     return new ActionDtoMapper().WithStatus().Map(actions);
 }
Example #4
0
 public int Count(SearchActionRequest request)
 {
     return _actionRepository.Count(request.ActionPlanId);
 }