public void DeleteStateEntity(StateEntity state) { if (state == null) throw new ArgumentNullException("state"); using (var connection = new SqlConnection(ConfigurationManager.ConnectionStrings[this.ConnectionStringName].ConnectionString)) { connection.Open(); var command = new SqlCommand("usp_DeleteStateEntity", connection) { CommandType = System.Data.CommandType.StoredProcedure }; command.Parameters.Add(new SqlParameter { Direction = ParameterDirection.Input, IsNullable = false, ParameterName = "@ID", SqlDbType = SqlDbType.UniqueIdentifier, SqlValue = state.ID }); command.ExecuteNonQuery(); } }
/// <summary> /// Создает пациента в базе данных /// </summary> /// <param name="firstName"></param> /// <param name="lastName"></param> /// <param name="birthDate"></param> /// <param name="sexType"></param> /// <returns>Новый пациент</returns> public async Task <PatientDto> CreatePatientAsync(string firstName, string lastName, DateTime birthDate, GenderType sexType) { var newPatient = new PatientEntity { FirstName = firstName, LastName = lastName, BirthDate = birthDate, GenderTypeId = sexType.Id }; Db.PatientEntities.Add(newPatient); await Db.SaveChangesAsync(); var newStatus = new StatusEntity { CreatedDate = DateTime.UtcNow, PatientId = newPatient.PatientId, PreviousStatusId = 0 }; Db.StatusEntities.Add(newStatus); await Db.SaveChangesAsync(); newStatus.PreviousStatusId = newStatus.StatusId; await Db.SaveChangesAsync(); var newState = new StateEntity { CreatedDate = DateTime.UtcNow, PatientId = newPatient.PatientId, StatusId = newStatus.StatusId, PreviousStateId = 0, StateTypeId = StateType.Initial.Id }; Db.StateEntities.Add(newState); await Db.SaveChangesAsync(); newState.PreviousStateId = newState.StatusId; await Db.SaveChangesAsync(); newPatient.StatusId = newStatus.StatusId; newPatient.StateId = newState.StateId; await Db.SaveChangesAsync(); var result = PatientDto.FromEntity(newPatient); result.Status = StatusDto.FromEntity(newStatus); result.PatientState = StateDto.FromEntity(newState); return(result); }
public override void DeleteJob(int jobId) { UseTransaction((conn, tran) => { var stateId = _queryService.InsertJobState(StateEntity.FromIState(new DeletedState(), jobId), conn); _queryService.UpdateJob(new JobEntity() { Id = jobId, StateId = stateId, State = DeletedState.DefaultName, ExpireAt = DateTime.UtcNow.Add(_options.DefaultJobExpiration) }, t => new { t.State, t.StateId, t.ExpireAt }, conn); }); }
/// <summary> Initializes the class members</summary> protected virtual void InitClassMembers() { _physicianProfile = null; _state = null; PerformDependencyInjection(); // __LLBLGENPRO_USER_CODE_REGION_START InitClassMembers // __LLBLGENPRO_USER_CODE_REGION_END OnInitClassMembersComplete(); }
public void ReqStateChange(REnvState nextState) { if (_curStateEntity != null) { _curStateEntity.Dispose(); _curStateEntity = null; } _curStateName = nextState; _curStateEntity = _stateFactoryRE.CreateState(nextState); _curStateEntity.Start(); }
public async Task SetValueAsync(string key, string value) { var entry = new StateEntity() { PartitionKey = key, RowKey = "", Value = value }; TableOperation insertOperation = TableOperation.InsertOrReplace(entry); await _table.ExecuteAsync(insertOperation); }
public CityRepositoryTest(CityRepositoryTestFixture fixture) { _dbContext = fixture.DbContext; _mapperMock = fixture.MapperMock; _orderByExpressionCreatorMock = fixture.OrderByExpressionCreatorMock; _memoryCacheMock = fixture.MemoryCacheMock; _repository = fixture.Repository; _city = fixture.City; _stateEntity = fixture.StateEntity; _fixture = fixture; }
public ResultDTO Post([FromBody] StateEntity StateEntity) { try { return(_State.CreateState(StateEntity)); } catch (Exception ex) { throw new ApiDataException(1000, "State not found", HttpStatusCode.NotFound); } }
public void MapSetsNameToStateEntityName() { const string expectedName = "Iowa"; var stateEntity = new StateEntity { Name = expectedName }; State state = _stateMapper.Map(stateEntity); Assert.AreEqual(expectedName, state.Name, "State Name was not mapped correctly."); }
IEnumerator _LoadSceneAndMarkAsLoaded(StateEntity entity, float delay) { if (!UnityEngine.SceneManagement.SceneManager.GetSceneByName(entity.sceneName).IsValid()) { var loadOperation = UnityEngine.SceneManagement.SceneManager.LoadSceneAsync(entity.sceneName, LoadSceneMode.Additive); yield return(new WaitUntil(() => loadOperation.isDone)); yield return(new WaitForSeconds(delay)); } entity.loaded = true; }
public static StateDto FromEntity(StateEntity state) { var result = new StateDto { StateId = state.StateId, StatusId = state.StatusId, CreatedDate = state.CreatedDate, StateType = (StateType)state.StateTypeId }; return(result); }
void CustomInitialize() { // These states should be set by generated code if (StateVariablesSetInEntity.CurrentState != StateEntity.VariableState.First) { throw new Exception("The uncategorized First state isn't set, but it is being set in Glue"); } if (StateVariablesSetInEntity.CurrentTopOrBottomState != StateEntity.TopOrBottom.Top) { throw new Exception("The categorized Top state isn't set, but it is being set in Glue"); } if (StateVariablesSetOnInstance.CurrentState != Entities.StateEntity.VariableState.Second) { throw new Exception("Setting uncategorized states on objects in Glue is not working properly"); } if (StateVariablesSetOnInstance.CurrentTopOrBottomState != Entities.StateEntity.TopOrBottom.Bottom) { throw new Exception("Setting categorized states on objects in Glue is not working properly"); } if (StateEntityWithoutCurrentStateVariableInstance.X != 64) { throw new Exception("The X value should be 64, but instead it's " + StateEntityWithoutCurrentStateVariableInstance.X + " which means CurrentState is set before variables. It shouldn't be"); } this.InstanceTestingVelocity.StartVelocityTesting(.2f); ChildEntity.CurrentState = StateEntityChild.VariableState.Fourth; if (ChildEntity.CurrentState != StateEntityChild.VariableState.Fourth) { throw new Exception("Setting child state in child entity isn't working."); } StateEntity parentEntity = ChildEntity; if (parentEntity.CurrentState != StateEntity.VariableState.Unknown) { throw new Exception("Getting child state from parent entity isn't working."); } if (this.OverridingVariableStateEntityInstance.VariableToGetChangedByState != 4) { throw new Exception("States aren't properly overriding default values."); } this.CurrentTextSizeCategoryState = TextSizeCategory.InterpolationInstanceTextSmall; this.InterpolateToState(TextSizeCategory.InterpolationInstanceTextLarge, 1); }
public OrderModel GetOrder(int id) { try { IEnumerable <int> listOfIds = _orderManager.GetIds(); if (listOfIds.Contains(id)) { OrderEntity selectedOrder = _orderManager.GetSingle(id); CustomerEntity customer = _customerManager.GetSingle(selectedOrder.CustomerId); ServiceEntity service = _serviceManager.GetSingle(selectedOrder.ServiceId); StateEntity state = _stateManager.GetSingle(selectedOrder.StatusId); OrderModel orderViewModel = new OrderModel { Id = selectedOrder.Id, Customer = new CustomerModel { Id = customer.Id, FirstName = customer.FirstName, LastName = customer.LastName, PhoneNumber = customer.PhoneNumber, Email = customer.Email }, Service = new ServiceModel { Id = service.Id, NameOfService = service.NameOfService, Price = service.Price }, Price = service.Price, Date = selectedOrder.DateOfProcedure, Status = new StateModel { Id = state.Id, OrderStatus = state.OrderStatus } }; return(orderViewModel); } else { throw new Exception($"Order with id {id} doesen't found"); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public State GetState(long stateId) { var stateEntity = new StateEntity(stateId); using (var adapter = PersistenceLayer.GetDataAccessAdapter()) { if (!adapter.FetchEntity(stateEntity)) { throw new ObjectNotFoundInPersistenceException <State>(stateId); } } return(_mapper.Map(stateEntity)); }
public override void MarkConsequentlyFailedJobs(int failedJobId) { UseTransaction((conn, tran) => { var dependentJobs = this._queryService.GetDependentWorkflowTree(failedJobId, conn); var state = new ConsequentlyFailed("Job marked as failed because one of jobs this job depends on has failed.", failedJobId); foreach (var job in dependentJobs) { var stateId = this._queryService.InsertJobState(StateEntity.FromIState(state, job.Id), conn); this._queryService.SetJobState(job.Id, stateId, state.Name, conn); } }); }
public bool UpdateState(StateEntity stateEntity) { try { var state = Mapper.Map <StateEntity, State>(stateEntity); bool isEditted = unitOfWork.StateRepository.Update(state); unitOfWork.Save(); return(isEditted); } catch (Exception) { return(false); } }
internal static StateDto ToDto(this StateEntity ent) { if (ent == null) { return(null); } return(new StateDto { Id = ent.Id, Abbreviation = ent.Abbreviation, Name = ent.Name }); }
public async Task DeleteAsync(State state) { var stateEntity = new StateEntity { Id = state.Id, RowVersion = state.RowVersion.ToArray() }; _dbContext.AttachEntity(stateEntity); _dbContext.Entry(stateEntity).State = EntityState.Deleted; await _dbContext.SaveChangesAsync(); _cache.Remove(CacheKeys.StatesKey); }
public StateEntity GetStates() { var states = _unitOfWork.StateRepository.Find(c => c.StateStatus == true && c.Country.CountryCode == "NG").ToList(); if (states.Count() > 0) { var stateEntity = new StateEntity() { Data = Mapper.Map <IList <State>, IList <StateModel> >(states), }; return(stateEntity); } return(null); }
public override void UpgradeFailedToScheduled(int jobId, IState failedState, IState scheduledState, DateTime nextRun, int retryCount) { UseTransaction((conn, tran) => { this._queryService.InsertJobState(StateEntity.FromIState(failedState, jobId), conn); var stateId = this._queryService.InsertJobState(StateEntity.FromIState(scheduledState, jobId), conn); this._queryService.UpdateJob( new JobEntity { Id = jobId, NextRetry = nextRun, RetryCount = retryCount, StateId = stateId, State = scheduledState.Name }, t => new { t.RetryCount, t.NextRetry, t.State, t.StateId }, conn); }); }
private StateEntity InsertStateEntity() { var stateEntity = new StateEntity { Id = Guid.NewGuid(), Name = "CityRepositoryTest", PolishName = "CityRepositoryTest", RowVersion = new byte[] { 1, 2, 4, 8, 16, 32, 64 } }; DbContext.States.Add(stateEntity); DbContext.SaveChanges(); return(stateEntity); }
public async Task <int> Add(StateEntity entity) { entity.CreatedOn = DateTime.Now; var sql = "INSERT INTO States (Id, Name, CreatedOn) Values (@Id, @Name, @CreatedOn);"; var affectedRows = await Connection.ExecuteAsync(sql, new { Id = entity.Id, Name = entity.Name, CreatedOn = entity.CreatedOn }, Transaction); return(affectedRows); /*using (var connection = new SqlConnection(_configuration.GetConnectionString("DefaultConnection"))) * { * connection.Open(); * var affectedRows = await connection.ExecuteAsync(sql, entity); * return affectedRows; * }*/ }
public async Task <int> Update(StateEntity entity) { entity.ModifiedOn = DateTime.Now; var sql = "UPDATE States SET Name = @Name, ModifiedOn = @ModifiedOn WHERE Id = @Id;"; var affectedRows = await Connection.ExecuteAsync(sql, new { Name = entity.Name, ModifiedOn = entity.ModifiedOn, Id = entity.Id }, Transaction); return(affectedRows); /*using (var connection = new SqlConnection(_configuration.GetConnectionString("DefaultConnection"))) * { * connection.Open(); * var affectedRows = await connection.ExecuteAsync(sql, entity); * return affectedRows; * }*/ }
private static async Task <StateEntity> InsertStateEntityAsync(RivaAdministrativeDivisionsDbContext context) { var stateEntity = new StateEntity { Id = Guid.NewGuid(), Name = "DeleteStateIntegrationTest", PolishName = "DeleteStateIntegrationTest", RowVersion = new byte[] { 0, 0, 0, 0, 0, 0, 70, 81 } }; context.States.Add(stateEntity); await context.SaveChangesAsync(); return(stateEntity); }
private static string PrepareExpectedResponse(StateEntity stateEntity) { var stateResponse = new StateResponse(stateEntity.Id, stateEntity.RowVersion, stateEntity.Name, stateEntity.PolishName); var settings = new JsonSerializerSettings { Formatting = Formatting.Indented, ContractResolver = new DefaultTestPlatformContractResolver { NamingStrategy = new CamelCaseNamingStrategy() } }; return(JsonConvert.SerializeObject(stateResponse, settings)); }
public HttpResponseMessage Put([FromBody] StateEntity StateEntity) { try { if (StateEntity.StateId > 0) { var result = _State.UpdateState(StateEntity.StateId, StateEntity); return(Request.CreateResponse(HttpStatusCode.OK, result)); } } catch { throw new ApiDataException(1000, "State not found", HttpStatusCode.NotFound); } return(Request.CreateResponse(HttpStatusCode.InternalServerError, "Internal Server Error")); }
private void InsertState(string name) { try { using (var states = new StateBusiness()) { var entity = new StateEntity(); entity.StateName = name; var opSuccessful = states.InsertState(entity); } } catch (Exception ex) { //Log exception error _loggingHandler.LogEntry(ExceptionHandler.GetExceptionMessageFormatted(ex), true); } }
// Use this for initialization void Start() { if (States.Length > 0) { current = States [0]; for (int i = 1; i < States.Length; ++i) { if (States [i].State != null) { States [i].State.enabled = false; } } enterCurrentState(); } }
/// <summary> /// Ajax查询所有状态 /// </summary> /// <returns></returns> public ActionResult AllStateAjax() { if (Request.IsAjaxRequest()) { // 临时用RDS来保存系统状态位置 var systemObj = _stateRealRepos.GetRDSState(); if (systemObj == null) { systemObj = new StateEntity(); systemObj.PositionX = 400; } // 默认认为系统运行即为正常状态 systemObj.Status = 1; var systemList = new ArrayList(); systemList.Add(systemObj); var list = _stateRealRepos.GetWordAndRTUState().ToList(); var workstationList = list.Where(x => x.Type == "W").ToList(); // 更新WS状态 double wsExpired = (double)Util.GetConfigValueObj("wsExpired"); //以分钟计 DateTime compareTime = DateTime.Now.AddMinutes(-wsExpired); if (workstationList != null && workstationList.Count > 0) { foreach (var item in list) { if (item.Time > compareTime) { item.Status = 1; } else { item.Status = 0; } } } var data = new { systemList = systemList, workstationList = workstationList, rtuList = list.Where(x => x.Type == "R").ToList() }; return(Json(data, JsonRequestBehavior.AllowGet)); } return(null); }
public async Task <Guid> Update(StateModel model) { var entity = new StateEntity(); entity.Name = model.Name; entity.Id = model.Id; var result = await _unitOfWork.States.Update(entity); _unitOfWork.Commit(); if (result > 0) { return(entity.Id); } else { return(Guid.Empty); } }
public async Task <Guid> Create(StateModel model) { var entity = new StateEntity(); entity.Name = model.Name; entity.Id = Guid.NewGuid(); var result = await _unitOfWork.States.Add(entity); _unitOfWork.Commit(); if (result == 1) { return(entity.Id); } else { return(Guid.Empty); } }
public void UpdateStateEntity(StateEntity state) { if (state == null) throw new ArgumentNullException("state"); using (var connection = new SqlConnection(ConfigurationManager.ConnectionStrings[this.ConnectionStringName].ConnectionString)) { connection.Open(); var command = new SqlCommand("usp_UpdateStateEntity", connection) { CommandType = System.Data.CommandType.StoredProcedure }; FillCommand(command, state); command.ExecuteNonQuery(); } }
private void Compare(StateEntity first, StateEntity second) { if (first == null) throw new ArgumentNullException("first"); if (second == null) throw new ArgumentNullException("second"); Assert.AreEqual(first, second); Assert.AreEqual(first.ID, second.ID); Assert.AreEqual(first.Name, second.Name); Assert.AreEqual(first.Visible, second.Visible); Assert.AreEqual(first.DateCreated.Truncate(TimeSpan.FromMilliseconds(100)), second.DateCreated.Truncate(TimeSpan.FromMilliseconds(100))); Assert.AreEqual(first.CreatedBy, second.CreatedBy); Assert.AreEqual(first.LastUpdated.HasValue ? first.LastUpdated.Value.Truncate(TimeSpan.FromMilliseconds(100)) : default(DateTime?), second.LastUpdated.HasValue ? second.LastUpdated.Value.Truncate(TimeSpan.FromMilliseconds(100)) : default(DateTime?)); Assert.AreEqual(first.LastUpdatedBy, second.LastUpdatedBy); }
internal void UpdateStateEntity(StateEntity stateProvince) { container.Resolve<IRainbowRepository>().UpdateStateEntity(stateProvince); }
internal void InsertStateEntity(StateEntity stateProvince) { container.Resolve<IPortalRepository>().InsertStateEntity(stateProvince); }
internal void DeleteStateEntity(StateEntity stateProvince) { container.Resolve<IPortalRepository>().DeleteStateEntity(stateProvince); }
private void FillCommand(SqlCommand command, StateEntity state) { command.Parameters.Add(new SqlParameter { Direction = ParameterDirection.Input, IsNullable = false, ParameterName = "@ID", SqlDbType = SqlDbType.UniqueIdentifier, SqlValue = state.ID }); command.Parameters.Add(new SqlParameter { Direction = ParameterDirection.Input, IsNullable = false, ParameterName = "@Name", SqlDbType = SqlDbType.NVarChar, Size = 200, SqlValue = state.Name }); command.Parameters.Add(new SqlParameter { Direction = ParameterDirection.Input, IsNullable = true, ParameterName = "@DateCreated", SqlDbType = SqlDbType.DateTime, SqlValue = state.DateCreated }); command.Parameters.Add(new SqlParameter { Direction = ParameterDirection.Input, IsNullable = true, ParameterName = "@CreatedBy", SqlDbType = SqlDbType.NVarChar, Size = 512, SqlValue = state.CreatedBy }); command.Parameters.Add(new SqlParameter { Direction = ParameterDirection.Input, IsNullable = true, ParameterName = "@LastUpdated", SqlDbType = SqlDbType.DateTime, SqlValue = state.LastUpdated }); command.Parameters.Add(new SqlParameter { Direction = ParameterDirection.Input, IsNullable = true, ParameterName = "@LastUpdatedBy", SqlDbType = SqlDbType.NVarChar, Size = 512, SqlValue = state.LastUpdatedBy }); command.Parameters.Add(new SqlParameter { Direction = ParameterDirection.Input, IsNullable = false, ParameterName = "@Visible", SqlDbType = SqlDbType.Bit, SqlValue = state.Visible }); }
public IEnumerable<StateEntity> GetStateEntities(Guid? id, string name) { var provinces = new List<StateEntity>(); using (var connection = new SqlConnection(ConfigurationManager.ConnectionStrings[this.ConnectionStringName].ConnectionString)) { connection.Open(); var command = new SqlCommand("usp_GetStateEntities", connection) { CommandType = System.Data.CommandType.StoredProcedure }; if (id.HasValue) { command.Parameters.Add(new SqlParameter { Direction = ParameterDirection.Input, IsNullable = true, ParameterName = "@ID", SqlDbType = SqlDbType.UniqueIdentifier, SqlValue = id.Value }); } if (!string.IsNullOrEmpty(name)) { command.Parameters.Add(new SqlParameter { Direction = ParameterDirection.Input, IsNullable = true, ParameterName = "@Name", SqlDbType = SqlDbType.NVarChar, Size = 200, SqlValue = name.Contains("%") ? name : "%" + name + "%" }); } IDataReader reader = command.ExecuteReader(); try { while (reader.Read()) { var item = new StateEntity { ID = new Guid(reader["ID"].ToString()), Name = reader["Name"].ToString(), DateCreated = Convert.ToDateTime(reader["DateCreated"]), CreatedBy = reader["CreatedBy"].ToString(), LastUpdated = reader["LastUpdated"] != DBNull.Value ? Convert.ToDateTime(reader["LastUpdated"]) : default(DateTime?), LastUpdatedBy = reader["LastUpdatedBy"] != DBNull.Value ? reader["LastUpdatedBy"].ToString() : null, Visible = Convert.ToBoolean(reader["Visible"]) }; provinces.Add(item); } } finally { if (!reader.IsClosed) reader.Close(); } } return provinces; }
public void CRUDStateEntity() { // Insert var state = new StateEntity { }; Assert.IsTrue(!state.IsValid && !string.IsNullOrEmpty(state.ValidationMessage) && state.ValidationMessage.Contains(ResourceStringLoader.GetResourceString("StateEntity_EmptyName"))); Assert.IsTrue(!state.IsValid && !string.IsNullOrEmpty(state.ValidationMessage) && state.ValidationMessage.Contains(ResourceStringLoader.GetResourceString("StateEntity_EmptyCreatedBy"))); state.Name = "01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"; state.CreatedBy = "01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456"; Assert.IsTrue(!state.IsValid && !string.IsNullOrEmpty(state.ValidationMessage) && state.ValidationMessage.Contains(ResourceStringLoader.GetResourceString("StateEntity_MaxNameLength"))); Assert.IsTrue(!state.IsValid && !string.IsNullOrEmpty(state.ValidationMessage) && state.ValidationMessage.Contains(ResourceStringLoader.GetResourceString("StateEntity_MaxCreatedByLength"))); state.Name = "New temporal state"; state.CreatedBy = "dcruz"; Assert.IsTrue(state.IsValid); Assert.IsTrue(state.IsNew); state.AcceptChanges(); Assert.IsTrue(state.IsValid); Assert.IsTrue(!state.IsChanged); var loaded = StateEntity.Load(state.ID); Assert.IsNotNull(loaded); Assert.IsTrue(!loaded.IsChanged); Assert.IsTrue(!loaded.IsNew); Compare(loaded, state); // Update loaded.Name = "01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"; Assert.IsTrue(!loaded.IsValid && !string.IsNullOrEmpty(loaded.ValidationMessage) && loaded.ValidationMessage.Contains(ResourceStringLoader.GetResourceString("StateEntity_MaxNameLength"))); Assert.IsTrue(!loaded.IsValid && !string.IsNullOrEmpty(loaded.ValidationMessage) && loaded.ValidationMessage.Contains(ResourceStringLoader.GetResourceString("StateEntity_EmptyLastUpdatedBy"))); var any = StateEntity.GetAll().Where(m => m.ID != loaded.ID).FirstOrDefault(); if (any == null) Assert.Inconclusive(); loaded.Name = any.Name; Assert.IsTrue(!loaded.IsValid && !string.IsNullOrEmpty(loaded.ValidationMessage) && loaded.ValidationMessage.Contains(ResourceStringLoader.GetResourceString("StateEntity_DuplicatedName", new { loaded.Name }))); Assert.IsTrue(!loaded.IsValid && !string.IsNullOrEmpty(loaded.ValidationMessage) && loaded.ValidationMessage.Contains(ResourceStringLoader.GetResourceString("StateEntity_EmptyLastUpdatedBy"))); loaded.Name = "New temporal state 2"; loaded.LastUpdatedBy = "01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456"; Assert.IsTrue(!loaded.IsValid && !string.IsNullOrEmpty(loaded.ValidationMessage) && loaded.ValidationMessage.Contains(ResourceStringLoader.GetResourceString("StateEntity_MaxLastUpdatedByLength"))); loaded.LastUpdatedBy = "dcruz"; Assert.IsTrue(loaded.IsChanged); Assert.IsTrue(loaded.IsValid); loaded.AcceptChanges(); Assert.IsTrue(!loaded.IsChanged); Assert.IsTrue(loaded.IsValid); var updated = StateEntity.Load(state.ID); Assert.IsNotNull(updated); Compare(updated, loaded); // Delete loaded = StateEntity.Load(state.ID); loaded.Delete(); Assert.IsTrue(loaded.IsValid); Assert.IsTrue(loaded.IsDeleted); loaded.AcceptChanges(); loaded = StateEntity.Load(state.ID); Assert.IsNull(loaded); }