public void InitializeWithDefaults()
        {
            IDomainObjectsConfiguration configuration = new FakeDomainObjectsConfiguration();

            Assert.That(configuration.MappingLoader, Is.TypeOf <MappingLoaderConfiguration>());
            Assert.That(configuration.Storage, Is.TypeOf <StorageConfiguration>());
            Assert.That(configuration.Query, Is.TypeOf <QueryConfiguration>());
        }
        public void GetAndSet()
        {
            IDomainObjectsConfiguration configuration =
                new FakeDomainObjectsConfiguration(new MappingLoaderConfiguration(), new StorageConfiguration(), new QueryConfiguration());

            DomainObjectsConfiguration.SetCurrent(configuration);

            Assert.That(DomainObjectsConfiguration.Current, Is.SameAs(configuration));
        }
        public void Initialize()
        {
            StorageConfiguration        storage       = new StorageConfiguration();
            MappingLoaderConfiguration  mappingLoader = new MappingLoaderConfiguration();
            QueryConfiguration          query         = new QueryConfiguration();
            IDomainObjectsConfiguration configuration = new FakeDomainObjectsConfiguration(mappingLoader, storage, query);

            Assert.That(configuration.MappingLoader, Is.SameAs(mappingLoader));
            Assert.That(configuration.Storage, Is.SameAs(storage));
            Assert.That(configuration.Query, Is.SameAs(query));
        }
示例#4
0
        public SchemaGenerationConfiguration()
        {
            var sqlStorageObjectFactory             = new SqlStorageObjectFactory();
            var storageProviderDefinitionCollection = new ProviderCollection <StorageProviderDefinition>
            {
                new RdbmsProviderDefinition(
                    DatabaseTest.SchemaGenerationFirstStorageProviderID,
                    sqlStorageObjectFactory,
                    DatabaseTest.SchemaGenerationConnectionString1),
                new RdbmsProviderDefinition(
                    DatabaseTest.SchemaGenerationSecondStorageProviderID,
                    sqlStorageObjectFactory,
                    DatabaseTest.SchemaGenerationConnectionString2),
                new RdbmsProviderDefinition(
                    DatabaseTest.SchemaGenerationThirdStorageProviderID,
                    sqlStorageObjectFactory,
                    DatabaseTest.SchemaGenerationConnectionString3),
                new RdbmsProviderDefinition(
                    DatabaseTest.SchemaGenerationInternalStorageProviderID,
                    sqlStorageObjectFactory,
                    DatabaseTest.SchemaGenerationConnectionString1)
            };

            _storageConfiguration = new StorageConfiguration(
                storageProviderDefinitionCollection,
                storageProviderDefinitionCollection[DatabaseTest.SchemaGenerationFirstStorageProviderID]);
            _storageConfiguration.StorageGroups.Add(
                new StorageGroupElement(
                    new FirstStorageGroupAttribute(),
                    DatabaseTest.SchemaGenerationFirstStorageProviderID));
            _storageConfiguration.StorageGroups.Add(
                new StorageGroupElement(
                    new SecondStorageGroupAttribute(),
                    DatabaseTest.SchemaGenerationSecondStorageProviderID));
            _storageConfiguration.StorageGroups.Add(
                new StorageGroupElement(
                    new ThirdStorageGroupAttribute(),
                    DatabaseTest.SchemaGenerationThirdStorageProviderID));
            _storageConfiguration.StorageGroups.Add(
                new StorageGroupElement(
                    new InternalStorageGroupAttribute(),
                    DatabaseTest.SchemaGenerationInternalStorageProviderID));

            _mappingLoaderConfiguration = new MappingLoaderConfiguration();
            _queryConfiguration         = new QueryConfiguration();

            var typeDiscoveryService = GetTypeDiscoveryService(GetType().Assembly);

            _mappingConfiguration = new MappingConfiguration(
                MappingReflectorObjectMother.CreateMappingReflector(typeDiscoveryService),
                new PersistenceModelLoader(new StorageGroupBasedStorageProviderDefinitionFinder(_storageConfiguration)));
            _domainObjectsConfiguration = new FakeDomainObjectsConfiguration(_mappingLoaderConfiguration, _storageConfiguration, _queryConfiguration);
        }