Пример #1
0
        public void Create_new_computer()
        {
            ComputersController computersController = new ComputersController();
            int numberOfComputers = computersController.All().Count;

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

            var allComputers             = computersController.All();
            int currentNumberOfComputers = allComputers.Count;

            Assert.AreEqual(numberOfComputers + 1, currentNumberOfComputers);
            Assert.IsNotNull(allComputers.First(comp => comp.Name == "TestComputer"));
        }
        public void Get_a_list_of_all_computers()
        {
            ComputersController computersController = new ComputersController();
            string expectedComputerName             = "MacBook Pro 15";

            List <ComputerInfoDto> computers = computersController.All();

            Assert.AreEqual(5, computers.Count);
            Assert.AreEqual(expectedComputerName, computers.First().Name);
        }