コード例 #1
0
        public void TankDoesNotRuptureWhenNoFaultsOccurLTL()
        {
            var     model    = new Model();
            Formula noFaults =
                !model.Sensor.SuppressIsEmpty.IsActivated &&
                !model.Sensor.SuppressIsFull.IsActivated &&
                !model.Pump.SuppressPumping.IsActivated &&
                !model.Timer.SuppressTimeout.IsActivated;

            var result = ModelChecker.Check(model, G(noFaults).Implies(!F(model.Tank.IsRuptured)));

            result.FormulaHolds.Should().BeTrue();
        }
コード例 #2
0
        public async Task <bool> ChangesCheckedAndSavedSuccessfully()
        {
            ModelChecker.Check(this.ModelState);

            TempData.CorrectEmptyArrays <int>();

            if (CategoryTypeSelection != null)
            {
                Category.CategoryType = _context.CategoryTypes.FirstOrDefault(x => x.Id == CategoryTypeSelection);
            }
            else
            {
                Category.CategoryType = null;
            }


            TempData.Clear();

            return(await SaveChanges.SavedSuccessfully(this._context, this._context.Categories, this.Category));
        }
コード例 #3
0
        public async Task <bool> ChangesCheckedAndSavedSuccessfully()
        {
            ModelChecker.Check(this.ModelState);

            TempData.CorrectEmptyArrays <int>();

            UpdateJoinTableFromSelectList.Update(_context.BrickCategories, Brick, TempData[nameof(categorySelectionOrig)] as int[], CategorySelect);

            UpdateJoinTableFromSelectList.Update(_context.BrickToBrick, Brick, TempData[nameof(childrenSelectOrig)] as int[], ChildrenSelect);

            UpdateJoinTableFromSelectList.Update(_context.BrickToBrick, Brick, TempData[nameof(parentsSelectOrig)] as int[], ParentsSelect, Relationship.Reversed);

            TempData.Clear();

            return(await SaveChanges.SavedSuccessfully(this._context, this._context.Bricks, this.Brick));

            /*
             * _context.Attach(Brick).State = EntityState.Modified;
             *
             * try
             * {
             *  await _context.SaveChangesAsync();
             * }
             * catch (DbUpdateConcurrencyException)
             * {
             *  if (!_context.Bricks.Any(e => e.Id == Brick.Id))
             *  {
             *      return false;
             *  }
             *  else
             *  {
             *      throw;
             *  }
             *
             * }
             * return true;*/
        }