Exemplo n.º 1
0
        public void DeleteDeviceInDeviceList_WithExistingId_DecrementListCount()
        {
            int noOfDevicesBevorDeleteDeviceFromList = devices.Count;

            DeviceListHandler.DeleteDeviceInDeviceList(devices, "dev1");

            Assert.AreEqual(noOfDevicesBevorDeleteDeviceFromList - 1, devices.Count);
        }
 public IHttpActionResult DeleteDevice(String id)
 {
     try
     {
         List <Device> devices      = ConfigurationAccess.GetDeviceListFromConfig();
         List <Device> modifiedList = DeviceListHandler.DeleteDeviceInDeviceList(devices, id);
         ConfigurationAccess.SaveDeviceListToConfig(modifiedList);
         return(Ok());
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
Exemplo n.º 3
0
        public void DeleteDeviceInDeviceList_WithNotExistingDevideId_ReturnsReadWriteException()
        {
            ReadWriteException ex = Assert.Catch <ReadWriteException>(() => DeviceListHandler.DeleteDeviceInDeviceList(devices, "dev3"));

            StringAssert.Contains("Löschen nicht erfolgreich, der Device mit Id dev3 ist nicht in der Konfiguration!", ex.Message);
        }