protected override void Context()
        {
            _observerBuilder         = A.Fake <IAmountObserverBuilder>();
            _editObserverBuilderView = A.Fake <IEditObserverBuilderView>();
            _buildingBlock           = new ObserverBuildingBlock();
            _editFormulaPresenter    = A.Fake <IEditFormulaPresenter>();
            _commandCollector        = A.Fake <ICommandCollector>();
            _observerMapper          = A.Fake <IObserverBuilderToDTOObserverBuilderMapper>();

            sut = new EditAmountObserverBuilderPresenter(
                _editObserverBuilderView,
                A.Fake <IMoBiContext>(),
                A.Fake <IEditTaskFor <IAmountObserverBuilder> >(),
                _observerMapper,
                A.Fake <IViewItemContextMenuFactory>(),
                _editFormulaPresenter,
                A.Fake <ISelectReferenceAtAmountObserverPresenter>(),
                A.Fake <IMoleculeDependentBuilderPresenter>(),
                A.Fake <IDescriptorConditionListPresenter <IObserverBuilder> >()
                );


            sut.InitializeWith(_commandCollector);
            sut.BuildingBlock = _buildingBlock;
            sut.Edit(_observerBuilder);
        }
        public void TestComplexObserverBB()
        {
            ObserverBuildingBlock x1 = _buildConfiguration.Observers as ObserverBuildingBlock;

            Assert.IsNotNull(x1);

            IObserverBuildingBlock x2 = SerializeAndDeserialize(x1);

            AssertForSpecs.AreEqualBuildingBlock(x2, x1);
        }
 protected override void Context()
 {
     base.Context();
     _buildConfiguration = A.Fake <IMoBiBuildConfiguration>();
     _bbInfo             = new ObserverBuildingBlockInfo {
         UntypedBuildingBlock = new ObserverBuildingBlock().WithId("SP1")
     };
     _buildConfiguration.ObserversInfo = _bbInfo;
     A.CallTo(() => _buildConfiguration.AllBuildingBlockInfos()).Returns(new[] { _bbInfo });
     _cloneBuildingBlock = new ObserverBuildingBlock().WithId("SP2");
     A.CallTo(() => _cloneManager.CloneBuidingBlock(_bbInfo.BuildingBlock)).Returns(_cloneBuildingBlock);
     A.CallTo(() => _simulation.MoBiBuildConfiguration).Returns(_buildConfiguration);
     A.CallTo(_nameCorrector).WithReturnType <bool>().Returns(true);
 }
        protected override void Context()
        {
            base.Context();
            _project = new MoBiProject();
            _observerBuildingBlock           = new ObserverBuildingBlock().WithName("OBSERVERS");
            _simulationSettingsBuildingBlock = new SimulationSettings().WithName("SIMULATION_SETTINGS");
            _simulationSettingsNode          = A.Fake <ITreeNode>();
            _observerBuildingBlockNode       = A.Fake <ITreeNode>();

            _allNodesAdded = new List <ITreeNode>();
            A.CallTo(() => _view.AddNode(A <ITreeNode> ._)).Invokes(x =>
            {
                _allNodesAdded.Add(x.GetArgument <ITreeNode>(0));
            });

            _project.AddBuildingBlock(_observerBuildingBlock);
            _project.AddBuildingBlock(_simulationSettingsBuildingBlock);

            A.CallTo(() => _treeNodeFactory.CreateFor(_simulationSettingsBuildingBlock)).Returns(_simulationSettingsNode);
            A.CallTo(() => _treeNodeFactory.CreateFor(_observerBuildingBlock)).Returns(_observerBuildingBlockNode);
        }
        protected override void Context()
        {
            base.Context();
            var observerBuildingBlock1        = new ObserverBuildingBlock().WithName("Tada");
            IObserverBuilder observerBuilderA = new ContainerObserverBuilder().WithName("OBS");
            var observerBuilderB = new ContainerObserverBuilder().WithName("ObsB");

            observerBuildingBlock1.Add(observerBuilderA);
            observerBuildingBlock1.Add(observerBuilderB);

            var observerBuildingBlock2 = new ObserverBuildingBlock().WithName("Tada");

            observerBuilderA = new AmountObserverBuilder().WithName("OBS");
            observerBuilderB = new ContainerObserverBuilder().WithName("ObsB");

            observerBuildingBlock2.Add(observerBuilderA);
            observerBuildingBlock2.Add(observerBuilderB);

            _object1 = observerBuildingBlock1;
            _object2 = observerBuildingBlock2;
        }
        protected override void Context()
        {
            _interactionTaskContext = A.Fake <IInteractionTaskContext>();
            _context        = A.Fake <IMoBiContext>();
            _project        = A.Fake <IMoBiProject>();
            _amountObserver = A.Fake <IAmountObserverBuilder>();
            _amountObserverBuilderWithForbiddenName = new AmountObserverBuilder {
                Name = "forbidden name"
            };
            _buildingBlock = new ObserverBuildingBlock {
                _amountObserverBuilderWithForbiddenName, _amountObserver
            };
            _interactionTask = A.Fake <IInteractionTask>();

            A.CallTo(() => _context.CurrentProject).Returns(_project);
            A.CallTo(() => _interactionTaskContext.Context).Returns(_context);
            A.CallTo(() => _project.ObserverBlockCollection).Returns(new[] { _buildingBlock });
            A.CallTo(() => _interactionTaskContext.InteractionTask).Returns(_interactionTask);

            sut = new EditTasksForAmountObserverBuilder(_interactionTaskContext);
        }