Exemple #1
0
        public void CheckAddingDevice()
        {
            var newDevice = new Device
            {
                Name             = "GasCooker",
                ProducingCountry = "Italy",
                Price            = 38.6,
                Rating           = 49
            };

            _deviceShop.AddItem(newDevice);
            Assert.AreEqual(2, _deviceShop.GetNumberOfItems());
            var receivedDevice = _deviceShop.BuyItem(newDevice.ProductIdentificator);

            Assert.AreEqual("GasCooker", receivedDevice.Name);
            Assert.AreEqual(38.6, receivedDevice.Price);
            Assert.AreEqual(49, receivedDevice.Rating);
            Assert.AreEqual("Italy", receivedDevice.ProducingCountry);
        }
Exemple #2
0
 public List <IDevice> AddDevice([FromBody] Device device)
 {
     _deviceShop.AddItem(device);
     return(_deviceShop.GetItems());
 }