public void DtoToModelEntityTest() { var componentTypeDto = new ComponentTypeDto { Id = 1, Name = "CPU" }; var brandDto = new BrandDto { Id = 1, Name = "Intel" }; var componentDto = new ComponentDto { Id = 1, Name = "Intel 6600k", ComponentType = componentTypeDto, Brand = brandDto, Price = 100 }; var model = _componentMapper.ToEntityModel(componentDto); Assert.Equal(componentDto.Id, model.Id); Assert.Equal(componentDto.Name, model.Name); Assert.Equal(componentDto.Price, model.Price); Assert.Equal(componentDto.Brand.Id, model.Brand.Id); Assert.Equal(componentDto.Brand.Name, model.Brand.Name); Assert.Equal(componentDto.ComponentType.Id, model.ComponentType.Id); Assert.Equal(componentDto.ComponentType.Name, model.ComponentType.Name); }
public static ComponentTypeInfo GetComponentTypeInfo(ComponentTypeDto dto) { if (dto == null) { return(null); } return(new ComponentTypeInfo(dto)); }
public ComponentTypeInfo(ComponentTypeDto dto) { if (dto == null) { throw new ArgumentNullException("dto"); } Id = dto.Id; SystemName = dto.SystemName; DisplayName = dto.DisplayName; IsSystem = dto.IsSystem; }
public void DtoToModelEntityTest() { var dto = new ComponentTypeDto { Id = 1, Name = "One" }; var model = _componentTypeMapper.ToEntityModel(dto); Assert.Equal(dto.Id, model.Id); Assert.Equal(dto.Name, model.Name); }
public IComponentTypeControl GetFolderComponentTypeControl() { var typeDto = new ComponentTypeDto() { SystemName = SystemComponentType.Folder.SystemName, DisplayName = SystemComponentType.Folder.SystemName, Id = SystemComponentType.Folder.Id, IsSystem = true }; var control = new ComponentTypeControlOnline( this, new ComponentTypeInfo(typeDto)); return(control); }