示例#1
0
        public void Create(PlatformTypeDto platform)
        {
            _logger.Info($"Creating new platform: name = {platform.Type}");

            _unitOfWork.PlatformTypeGenericRepository.Create(_mapper.Map <PlatformType>(platform));

            _unitOfWork.Commit();
        }
        public void ShouldMap_PlatformTypeDto_To_PlatformTypeViewModel()
        {
            var platformType = new PlatformTypeDto(1, "type");

            PlatformTypeViewModel result = platformType.ToViewModel();

            Assert.AreEqual(platformType.Id, result.Id);
            Assert.AreEqual(platformType.Type, result.Type);
        }
示例#3
0
        public void Update(PlatformTypeDto platformTypeDto)
        {
            _logger.Info($"Updating the platform: id = {platformTypeDto.Id}, name = {platformTypeDto.Type}");

            var platform = _mapper.Map <PlatformType>(platformTypeDto);

            _unitOfWork.PlatformTypeGenericRepository.Update(platform);

            _unitOfWork.Commit();
        }
        public void ShouldGetExistingPlatformType_ById()
        {
            var platformType = new PlatformType("type");

            _mock.Setup(m => m.PlatformTypes.Get(It.IsAny <int>()))
            .Returns(platformType);

            PlatformTypeDto platformTypeDto = _service.Get(It.IsAny <int>());

            Assert.AreEqual("type", platformTypeDto.Type);
        }
        public void ShouldReturnAllPlatformTypes()
        {
            _mock.Setup(m => m.PlatformTypes.GetAll())
            .Returns(new List <PlatformType> {
                new PlatformType("type")
            });

            IEnumerable <PlatformTypeDto> platformTypes = _service.GetAllPlatformTypes();
            PlatformTypeDto platformType = platformTypes.First();

            Assert.AreEqual("type", platformType.Type);
        }
示例#6
0
 public static PlatformTypeViewModel ToViewModel(this PlatformTypeDto platformType)
 {
     return(new PlatformTypeViewModel(
                platformType.Id,
                platformType.Type));
 }