Esempio n. 1
0
        public void Preparation()
        {
            _container = MockHelper.InitializeContainer(AssembliesWhichShouldProvideExport, new Type[0]);

            _model1 = new Model { Element = Guid.Empty, Key = Guid.NewGuid(), Name = "M1" };
            _model2 = new Model { Element = Guid.Empty, Key = Guid.NewGuid(), Name = "M2" };
            _e1 = new Element {Key = Guid.NewGuid(), Model = _model1.Key, Name = "El1"};
            _e2 = new Element { Key = Guid.NewGuid(), Model = _model1.Key, Name = "El2" };
            _e3 = new Element { Key = Guid.NewGuid(), Model = _model2.Key, Name = "El3" };
            var pool = new ResourcePool();
            pool.Models.Add(_model1.Key, _model1);
            pool.Models.Add(_model2.Key, _model2);
            pool.Elements.Add(_e1.Key, _e1);
            pool.Elements.Add(_e2.Key, _e2);
            pool.Elements.Add(_e3.Key, _e3);
            _container.ComposeExportedValue(pool);
            _container.ComposeExportedValue(_container);
            Settings.NoCacheGarbageChecking = true;
            _pool = _container.GetExportedValue<ITypedPool>();
        }
Esempio n. 2
0
        public void Preparation()
        {
            _container =
                new CompositionContainer(new AggregateCatalog(AssembliesWhichShouldProvideExport.Select(k=>new AssemblyCatalog(k))));
                

            _singleModel = new Model { Element = Guid.Empty, Key = Guid.NewGuid(), Name = "SingleModel" };
            _singleElement = new Element() { Model = Guid.Empty, Key = Guid.NewGuid(), Name = "SingleElement" };
            _dependentModel = new Model { Element = Guid.NewGuid(), Key = Guid.NewGuid(), Name = "DepModel" };
            _dependentElement = new Element() { Model = _dependentModel.Key, Key = _dependentModel.Element, Name = "DepElement" };
            var pool = new ResourcePool();
            pool.Models.Add(_singleModel.Key, _singleModel);
            pool.Models.Add(_dependentModel.Key, _dependentModel);
            pool.Elements.Add(_singleElement.Key, _singleElement);
            pool.Elements.Add(_dependentElement.Key, _dependentElement);

            _container.ComposeExportedValue(pool);
            _container.ComposeExportedValue(_container);
            Settings.NoCacheGarbageChecking = true;
            _cachier = _container.GetExportedValue<ITypedPool>();         
        }