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); }
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); }
public static PlatformTypeViewModel ToViewModel(this PlatformTypeDto platformType) { return(new PlatformTypeViewModel( platformType.Id, platformType.Type)); }