public XElement Visit(TechnicalProfile technicalProfile)
 {
     return(new XElement(nameof(TechnicalProfile),
                         new XAttribute("Id", technicalProfile.Id),
                         new XElement("DisplayName", technicalProfile.DisplayName),
                         Visit(technicalProfile.Protocol),
                         VisitMetaData(technicalProfile.Metadata)
                         ));
 }
Exemplo n.º 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());
        }