Beispiel #1
0
 /// <summary>
 /// 删除一个规则
 /// </summary>
 /// <param name="validationErrors">返回的错误信息</param>
 /// <param name="id">一规则的主键</param>
 /// <returns></returns>
 public bool Delete(ref ValidationErrors validationErrors, string id)
 {
     try
     {
         return(repository.Delete(id) == 1);
     }
     catch (Exception ex)
     {
         validationErrors.Add(ex.Message);
         ExceptionsHander.WriteExceptions(ex);
     }
     return(false);
 }
Beispiel #2
0
        public async Task Remove(int id)
        {
            using (var uow = UnitOfWorkProvider.Create())
            {
                var rule = new Rule()
                {
                    Id = id
                };
                uow.Context.Attach(rule);

                _ruleRepository.Delete(rule);

                await uow.CommitAsync();
            }
        }
        public void Delete_Removes_Existing_Rule()
        {
            // Arrange
            m_Sut.Add(m_RuleOne);
            m_Sut.Add(m_RuleTwo);

            // Act
            m_Sut.Delete(m_RuleOne);

            // Assert
            IRule <ICellInformation>[] actual = m_Sut.Rules.ToArray();
            Assert.AreEqual(1,
                            actual.Length);
            Assert.AreEqual(m_RuleTwo,
                            actual [0]);
        }