public void CreateObservers(IBuildConfiguration buildConfiguration, IModel model)
        {
            _allContainers      = model.Root.GetAllChildren <IContainer>().ToList();
            _buildConfiguration = buildConfiguration;
            var observers        = buildConfiguration.Observers;
            var presentMolecules = buildConfiguration.AllPresentMolecules().ToList();

            try
            {
                foreach (var observerBuilder in observers.AmountObserverBuilders)
                {
                    createAmountObserver(observerBuilder, model, presentMolecules);
                }


                foreach (var observerBuilder in observers.ContainerObserverBuilders)
                {
                    createContainerObserver(observerBuilder, model, presentMolecules);
                }
            }
            finally
            {
                _allContainers.Clear();
                _buildConfiguration = null;
            }
        }
        protected override void Context()
        {
            _observerMapper        = A.Fake <IObserverBuilderToObserverMapper>();
            _buildConfiguration    = A.Fake <IBuildConfiguration>();
            _observerBuildingBlock = new ObserverBuildingBlock();
            _model = A.Fake <IModel>();
            _buildConfiguration.Observers = _observerBuildingBlock;
            A.CallTo(() => _buildConfiguration.AllPresentMolecules()).Returns(new[] { A.Fake <IMoleculeBuilder>().WithName(_molecule1), A.Fake <IMoleculeBuilder>().WithName(_molecule2) });
            _rootContainer = new Container();

            _organism = new Container().WithName("Organism");
            _organism.AddTag(new Tag("Organism"));
            _rootContainer.Add(_organism);

            _rootNeihgborhood    = new Container();
            _model.Root          = _rootContainer;
            _model.Neighborhoods = _rootNeihgborhood;
            _keywordReplacerTask = A.Fake <IKeywordReplacerTask>();
            _containerTask       = A.Fake <IContainerTask>();
            sut = new ObserverBuilderTask(_observerMapper, _containerTask, _keywordReplacerTask);
        }
 private void createGlobalMoleculeContainers(IModel model, IBuildConfiguration buildConfiguration)
 {
     buildConfiguration.AllPresentMolecules()
     .Each(m => _moleculePropertiesContainerTask.CreateGlobalMoleculeContainerFor(model.Root, m, buildConfiguration));
 }