コード例 #1
0
        protected override void Context()
        {
            base.Context();
            _originalFormula1     = new ExplicitFormula().WithName("F1").WithId("X1");
            _originalFormula2     = new ExplicitFormula().WithName("F2").WithId("X2");
            _buildingBlockToClone = new MoleculeBuildingBlock();
            var clonedBuildinBlock = new MoleculeBuildingBlock();

            _buildingBlockToClone.AddFormula(_originalFormula1);
            _buildingBlockToClone.AddFormula(_originalFormula2);

            _cloneFormula1 = new ExplicitFormula().WithName("F1").WithId("X11");
            _cloneFormula2 = new ExplicitFormula().WithName("F2").WithId("X22");

            A.CallTo(() => _cloneManagerForBuildingBlock.Clone(_originalFormula2)).Returns(_cloneFormula2);
            A.CallTo(() => _cloneManagerForBuildingBlock.Clone(_buildingBlockToClone, A <IFormulaCache> ._))
            .Invokes(x =>
            {
                var formulaCache = x.GetArgument <IFormulaCache>(1);
                formulaCache.Add(_cloneFormula1);
            })
            .Returns(clonedBuildinBlock);
        }
コード例 #2
0
 protected override void Context()
 {
     base.Context();
     _buildingBlock = new MoBiSpatialStructure();
     _formula       = new ExplicitFormula().WithName("Formula").WithId("F1");
     _buildingBlock.AddFormula(_formula);
     _commandCollector = A.Fake <ICommandCollector>();
     sut.InitializeWith(_commandCollector);
     sut.Edit(_buildingBlock);
     _dtoFormula    = new FormulaBuilderDTO();
     _dtoFormula.Id = _formula.Id;
     A.CallTo(() => _formulaChecker.FormulaUsedIn(_buildingBlock, _formula)).Returns(false);
     A.CallTo(() => _messagePresenter.MessageBoxYesNo(AppConstants.Captions.ReallyDeleteFormula(_formula.Name), ViewResult.Yes))
     .Returns(ViewResult.Yes);
 }
コード例 #3
0
        protected override void Context()
        {
            base.Context();
            _parameter = A.Fake <IParameter>();
            _buidingBlockWithFormulaCache = new ParameterStartValuesBuildingBlock();


            _oldFormula        = new ExplicitFormula("1+2").WithId("OLD_FORMULA");
            _parameter.Formula = _oldFormula;
            _explicitFormula   = new ExplicitFormula {
                Id = "Formula", Name = "toto"
            };
            A.CallTo(() => _context.ObjectRepository.ContainsObjectWithId(_oldFormula.Id)).Returns(true);
            A.CallTo(() => _formulaTask.CreateNewFormula(typeof(ExplicitFormula), _parameter.Dimension)).Returns(_explicitFormula);

            sut.Init(_parameter, _buidingBlockWithFormulaCache);

            //add so that it will be found when setting the value in the parameter
            _buidingBlockWithFormulaCache.AddFormula(_explicitFormula);

            A.CallTo(() => _formulaTask.CreateNewFormulaInBuildingBlock(A <Type> ._, A <IDimension> ._, A <IEnumerable <string> > ._, _buidingBlockWithFormulaCache))
            .Returns((A.Fake <IMoBiCommand>(), _explicitFormula));
        }
コード例 #4
0
 public void should_Not_Add_a_formula_to_formula_cache()
 {
     A.CallTo(() => _formulaCache.Add(A <Formula> ._)).MustNotHaveHappened();
     A.CallTo(() => _buidingBlockWithFormulaCache.AddFormula(A <Formula> ._)).MustNotHaveHappened();
 }
コード例 #5
0
 public void should_not_add_formula_to_formula_cache()
 {
     A.CallTo(() => _buildingBlockToAddTo.AddFormula(_newFormula)).MustNotHaveHappened();
 }