Exemple #1
0
        public TechnicalProfileViewModel Get(int id)
        {
            var response = _technicalProfileAppService.GetById(id);

            viewModel = _mapper.Map <TechnicalProfile, TechnicalProfileViewModel>(response);

            return(viewModel);
        }
Exemple #2
0
        public void GetAllReturnAll_Success()
        {
            List <TechnicalProfile> list =
                new List <TechnicalProfile>();

            List <TechnicalProfileViewModel> viewModelList =
                new List <TechnicalProfileViewModel>();

            TechnicalProfile technicalProfile =
                new TechnicalProfile()
            {
                Id = 1, Description = "Test.Description", Name = "Test.Name"
            };

            TechnicalProfileViewModel viewModel =
                new TechnicalProfileViewModel()
            {
                Id = 1, Description = "Test.Description", Name = "Test.Name"
            };

            list.Add(technicalProfile);
            viewModelList.Add(viewModel);

            _mockAppService
            .Setup(mock => mock.GetAll())
            .Returns(() => list);

            _mockAppService.Object.GetAll();

            _mockMapper
            .Setup(mock => mock.Map <IList <TechnicalProfile>, IList <TechnicalProfileViewModel> >(It.IsAny <IList <TechnicalProfile> >()))
            .Returns(() => viewModelList);

            _mockMapper.Object.Map(technicalProfile, viewModel);

            var result = _controller.Get();

            Assert.NotNull(result);
            Assert.NotEmpty(result);
            _mockAppService.Verify(param => param.GetAll(), Times.AtLeastOnce());
            _mockMapper.Verify(param => param.Map(technicalProfile, viewModel), Times.AtLeastOnce());
        }