示例#1
0
        public void ctr_should_delete_device()
        {
            var vmdl = ControllerHelper.GetValidDeviceViewModel();

            vmdl.InvNum = Guid.NewGuid().ToString();
            var obj = ctr.PostDevice(vmdl) as OkObjectResult;
            var res = obj?.Value as List <DeviceViewModel>;

            Assert.NotNull(res);

            var d = Bl.GetSingleDevice(vmdl.InvNum);

            Assert.True(d.InvNum.Equals(vmdl.InvNum));

            var deviceToDelete = Bl.GetSingleDevice(vmdl.InvNum);

            deviceToDelete.DeviceId = 1010;
            ctr.DeleteDevice(deviceToDelete.DeviceId);
            var deletedDevice = Bl.GetSingleDevice(vmdl.InvNum);

            Assert.True(deletedDevice.IsActive.Equals(false));
        }