Exemplo n.º 1
0
        public void Update_computer_name()
        {
            ComputersController computersController = new ComputersController();

            _managementController.AddComputer(new AddComputerDto
            {
                Name          = "TestComputer",
                Description   = "New computer",
                Price         = 1500,
                ImageFilename = "test.png"
            });

            ComputerInfoDto   computerInfoDto   = computersController.FindComputerByName("TestComputer");
            UpdateComputerDto updateComputerDto = new UpdateComputerDto
            {
                Name          = "Amstrad CPC",
                Description   = "New Amstrad with 128Kb",
                Price         = 1000,
                ImageFilename = "amstrad.png"
            };

            _managementController.UpdateComputer(computerInfoDto.Id, updateComputerDto);

            ComputerInfoDto updatedComputer = computersController.GetComputerInfo(computerInfoDto.Id);

            Assert.AreEqual(computerInfoDto.Id, updatedComputer.Id);
            Assert.AreEqual(updateComputerDto.Name, updatedComputer.Name);
            Assert.AreEqual(updateComputerDto.Description, updatedComputer.Description);
            Assert.AreEqual(updateComputerDto.Price, updatedComputer.Price);
            Assert.AreEqual(updateComputerDto.ImageFilename, updatedComputer.ImageFilename);
        }