public void Assemble_part_dto_from_part()
        {
            var assembler = new PartAssembler();
            var part      = Fixtures.BuildSinglePart();

            var partDto = assembler.WritePartDto(part);

            Assert.Equal(5, partDto.Components.Count());
            Assert.Equal(5, partDto.Labor.Count());
        }
        public void get_part_dto_from_assembler()
        {
            var repository         = new PartRepository(_db);
            var assembler          = new PartAssembler();
            var partCatalogService = new PartCatalogService(repository, assembler);

            var partDto = partCatalogService.GetPart("TEST-PART-NUMBER|1");

            partDto.Should().BeOfType <PartDTO>();
        }
        public void get_part_catalog_dto_from_assembler()
        {
            var repository         = new PartRepository(_db);
            var assembler          = new PartAssembler();
            var partCatalogService = new PartCatalogService(repository, assembler);

            var partCatalogDto = partCatalogService.GetAllParts();

            _output.WriteLine(partCatalogDto.ToJson());
            partCatalogDto.Should().BeOfType <List <PartDTO> >();
        }
        public void Calculating_total_cost_of_a_parts_components()
        {
            var repository = new PartRepository(_db);
            var assembler  = new PartAssembler();
            var service    = new PartCatalogService(repository, assembler);

            var partDto = service.GetPart("TEST-PART-NUMBER|0");

            partDto.Quantity = 50;

            _output.WriteLine(partDto.TotalComponentCost.ToString());
        }
Esempio n. 5
0
 public PartCatalogService(IRepository <Part> partRepository, PartAssembler partAssembler)
 {
     _partRepository = partRepository;
     _partAssembler  = partAssembler;
 }