Ejemplo n.º 1
0
        public async Task <PcPartBasic> GetPartsBasicById(int id)
        {
            var part = await GetById(id);

            PcPartBasic result = mapper.Map <PcPart, PcPartBasic>(part);

            return(result);
        }
Ejemplo n.º 2
0
        public void TestNewOrNahServiceTrue()
        {
            // arrange
            DateTime date = DateTime.Now;

            // act
            PcPartBasic partBasic = new PcPartBasic
            {
                Hot = DtoServices.NewOrNah(date)
            };

            // assert
            Assert.True(partBasic.Hot);
        }
Ejemplo n.º 3
0
        [Fact] // isnt right when testingen but when debugging it is?
        public void TestNewOrNahServiceFalse()
        {
            // arrange
            DateTime date = DateTime.Now.Subtract(new TimeSpan(6, 0, 0, 0));

            // act
            PcPartBasic partBasic = new PcPartBasic
            {
                Hot = DtoServices.NewOrNah(date)
            };

            // assert
            Assert.True(!partBasic.Hot);
        }
Ejemplo n.º 4
0
        public void OnGet(int id)
        {
            basicPart = WebApiHelper.GetApiResult <PcPartBasic>(baseUri + "pcparts/basic/" + id);
            switch (basicPart.Type)
            {
            case "Cpu":
                Part       = WebApiHelper.GetApiResult <Cpu>(baseUri + "pcparts/PartByPartId/" + id) ?? new Cpu {
                };
                Properties = Part.GetType().GetProperties();
                break;

            case "Gpu":
                Part       = WebApiHelper.GetApiResult <Gpu>(baseUri + "pcparts/PartByPartId/" + id) ?? new Gpu();
                Properties = Part.GetType().GetProperties();
                break;

            case "PcCase":
                Part       = WebApiHelper.GetApiResult <PcCase>(baseUri + "pcparts/PartByPartId/" + id) ?? new PcCase();
                Properties = Part.GetType().GetProperties();
                break;

            case "Memory":
                Part = WebApiHelper.GetApiResult <Memory>(baseUri + "pcparts/PartByPartId/" + id) ?? new Memory();

                Properties = Part.GetType().GetProperties();
                break;

            case "MotherBoard":
                Part       = WebApiHelper.GetApiResult <MotherBoard>(baseUri + "pcparts/PartByPartId/" + id) ?? new MotherBoard();
                Properties = Part.GetType().GetProperties();
                break;

            default:
                Properties = null;
                break;
            }
        }