public void UpdateDeviceTypeUsingUpsertTest()
        {
            TestDeviceType.DeviceTypeName = TestDeviceTypeName + " updated";
            DeviceTypeService.Upsert(TestDeviceType, TestUserPrincipal);
            var foundDeviceTypes = DeviceTypeService.Search(TestDeviceTypeName + " updated").ToList();

            Assert.AreEqual(1, foundDeviceTypes.Count);
            Assert.AreEqual(foundDeviceTypes.First().DeviceTypeName, TestDeviceType.DeviceTypeName);
        }
        public void CreateNewDeviceTypeWithUpsertTest()
        {
            var newDeviceType = new DeviceType {
                DeviceTypeName = "New Upsert Test Device Type", DeviceCategoryId = TestDeviceCategory.DeviceCategoryId
            };

            DeviceTypeService.Upsert(newDeviceType, TestUserPrincipal);
            var foundDeviceTypes = DeviceTypeService.Search("New Upsert Test Device Type").ToList();

            Assert.AreEqual(1, foundDeviceTypes.Count);
            Assert.AreEqual(foundDeviceTypes.First().DeviceTypeName, newDeviceType.DeviceTypeName);

            DeviceTypeService.DeleteByGuid(foundDeviceTypes.First().DeviceTypeId);
        }
        public void InsertDeviceTypeWithNameThatIsSoftDeletedTest()
        {
            TestDeviceType.IsDeleted = true;
            DeviceTypeService.Update(TestDeviceType);

            var newDeviceType = new DeviceType {
                DeviceTypeName = TestDeviceTypeName, DeviceCategoryId = TestDeviceCategory.DeviceCategoryId
            };

            DeviceTypeService.Upsert(newDeviceType, TestUserPrincipal);

            var foundDeviceTypes = DeviceTypeService.Search(TestDeviceTypeName).ToList();

            Assert.AreEqual(1, foundDeviceTypes.Count);
            Assert.AreEqual(foundDeviceTypes.First().DeviceTypeName, TestDeviceType.DeviceTypeName);
            Assert.IsFalse(foundDeviceTypes.First().IsDeleted);
        }
 public void InsertDeviceTypeThatAlreadyExistsTest()
 {
     TestDeviceType.IsDeleted = true;
     DeviceTypeService.Upsert(TestDeviceType, TestUserPrincipal);
 }