Esempio n. 1
0
        public void UpdateDeviceSettingUsingUpsertTest()
        {
            TestDeviceSetting.DeviceSettingName = TestDeviceSettingName + " updated";
            DeviceSettingService.Upsert(TestDeviceSetting, TestUserPrincipal);
            var foundDeviceSettings = DeviceSettingService.Search(TestDeviceSettingName + " updated").ToList();

            Assert.AreEqual(1, foundDeviceSettings.Count);
            Assert.AreEqual(foundDeviceSettings.First().DeviceSettingName, TestDeviceSetting.DeviceSettingName);
        }
Esempio n. 2
0
        public void SoftDeleteDeviceSettingTest()
        {
            var foundDeviceSettings = DeviceSettingService.Search(TestDeviceSettingName).ToList();

            Assert.AreEqual(1, foundDeviceSettings.Count);
            DeviceSettingService.SoftDelete(foundDeviceSettings.First().DeviceSettingId, TestUserPrincipal);

            var softDeleteDeviceSetting = DeviceSettingService.Search(TestDeviceSettingName).ToList();

            Assert.AreEqual(1, softDeleteDeviceSetting.Count);
            Assert.IsTrue(softDeleteDeviceSetting.First().IsDeleted);
        }
Esempio n. 3
0
        public DeviceSetting CreateTestDeviceSetting(string deviceSettingName = TestDeviceSettingName)
        {
            var newTestDeviceSetting = new DeviceSetting
            {
                DeviceSettingName  = deviceSettingName,
                DeviceSettingValue = TestDeviceSettingValue,
                OwnedDeviceId      = TestOwnedDevice.OwnedDeviceId
            };

            DeviceSettingService.Insert(newTestDeviceSetting);
            newTestDeviceSetting = DeviceSettingService.Search(deviceSettingName).First();
            return(newTestDeviceSetting);
        }
Esempio n. 4
0
        public void InsertDeviceSettingWithNameThatIsSoftDeletedTest()
        {
            TestDeviceSetting.IsDeleted = true;
            DeviceSettingService.Update(TestDeviceSetting);

            var newDeviceSetting = new DeviceSetting {
                DeviceSettingName = TestDeviceSettingName, DeviceSettingValue = TestDeviceSettingValue
            };

            DeviceSettingService.Upsert(newDeviceSetting, TestUserPrincipal);

            var foundDeviceSettings = DeviceSettingService.Search(TestDeviceSettingName).ToList();

            Assert.AreEqual(1, foundDeviceSettings.Count);
            Assert.AreEqual(foundDeviceSettings.First().DeviceSettingName, TestDeviceSetting.DeviceSettingName);
            Assert.AreEqual(foundDeviceSettings.First().DeviceSettingValue, TestDeviceSetting.DeviceSettingValue);
            Assert.IsFalse(foundDeviceSettings.First().IsDeleted);
        }
Esempio n. 5
0
        public void CreateNewDeviceSettingWithUpsertTest()
        {
            var newDeviceSetting = new DeviceSetting
            {
                DeviceSettingName  = "New Upsert Test Device Setting",
                DeviceSettingValue = "New Device Setting Upsert Value",
                OwnedDeviceId      = TestOwnedDevice.OwnedDeviceId
            };

            DeviceSettingService.Upsert(newDeviceSetting, TestUserPrincipal);
            var foundDeviceSettings = DeviceSettingService.Search("New Upsert Test Device Setting").ToList();

            Assert.AreEqual(1, foundDeviceSettings.Count);
            Assert.AreEqual(foundDeviceSettings.First().DeviceSettingName, newDeviceSetting.DeviceSettingName);
            Assert.AreEqual(foundDeviceSettings.First().DeviceSettingValue, newDeviceSetting.DeviceSettingValue);

            DeviceSettingService.DeleteByGuid(foundDeviceSettings.First().DeviceSettingId);
        }