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 DeviceType CreateTestDeviceType()
        {
            var newDeviceType = new DeviceType {
                DeviceTypeName = TestDeviceTypeName, DeviceCategoryId = TestDeviceCategory.DeviceCategoryId
            };

            DeviceTypeService.Insert(newDeviceType);
            newDeviceType = DeviceTypeService.Search(TestDeviceTypeName).First();
            return(newDeviceType);
        }
        public void SoftDeleteDeviceTypeTest()
        {
            var foundDeviceTypes = DeviceTypeService.Search(TestDeviceTypeName).ToList();

            Assert.AreEqual(1, foundDeviceTypes.Count);
            DeviceTypeService.SoftDelete(foundDeviceTypes.First().DeviceTypeId, TestUserPrincipal);

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

            Assert.AreEqual(1, softDeletedAccount.Count);
            Assert.IsTrue(softDeletedAccount.First().IsDeleted);
        }
        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);
        }