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 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); }
DeviceTypeService _dts;//= new DeviceTypeService(); public DeviceTypeController() { _dts = new DeviceTypeService(); }
public void UniqueNameCheckNonDuplicateAccountTest() { var uniqueName = DeviceTypeService.CheckForExistingDeviceType("Testing Device Type"); Assert.IsNull(uniqueName); }
public void UniqueNameCheckDuplicateDeviceTypeTest() { var uniqueName = DeviceTypeService.CheckForExistingDeviceType(TestDeviceTypeName); Assert.AreEqual(TestDeviceType.DeviceTypeName, uniqueName.DeviceTypeName); }
public void InsertDeviceTypeThatAlreadyExistsTest() { TestDeviceType.IsDeleted = true; DeviceTypeService.Upsert(TestDeviceType, TestUserPrincipal); }
public void SoftDeleteDeviceTypeThatDoesNotExistTest() { var guid = Guid.NewGuid(); DeviceTypeService.SoftDelete(guid, TestUserPrincipal); }
public DeviceTypeServiceTests() { _mockUnit = new Mock <IUnitOfWork>(); _deviceTypeService = new DeviceTypeService(_mockUnit.Object); }