public override void SetUp()
        {
            base.SetUp();

            _tableViewElementFactoryStub  = MockRepository.GenerateStub <IViewScriptElementFactory <TableDefinition> >();
            _unionViewElementFactoryStub  = MockRepository.GenerateStub <IViewScriptElementFactory <UnionViewDefinition> >();
            _filterViewElementFactoryStub = MockRepository.GenerateStub <IViewScriptElementFactory <FilterViewDefinition> >();
            _emptyViewElementFactoryStub  = MockRepository.GenerateStub <IViewScriptElementFactory <EmptyViewDefinition> >();

            _builder = new ViewScriptBuilder(
                _tableViewElementFactoryStub,
                _unionViewElementFactoryStub,
                _filterViewElementFactoryStub,
                _emptyViewElementFactoryStub,
                new SqlCommentScriptElementFactory());

            _tableDefinition1      = TableDefinitionObjectMother.Create(SchemaGenerationFirstStorageProviderDefinition);
            _tableDefinition2      = TableDefinitionObjectMother.Create(SchemaGenerationFirstStorageProviderDefinition);
            _unionViewDefinition1  = UnionViewDefinitionObjectMother.Create(SchemaGenerationFirstStorageProviderDefinition);
            _unionViewDefinition2  = UnionViewDefinitionObjectMother.Create(SchemaGenerationFirstStorageProviderDefinition);
            _filterViewDefinition1 = FilterViewDefinitionObjectMother.Create(SchemaGenerationFirstStorageProviderDefinition);
            _filterViewDefinition2 = FilterViewDefinitionObjectMother.Create(SchemaGenerationFirstStorageProviderDefinition);
            _emptyViewDefinition1  = EmptyViewDefinitionObjectMother.Create(SchemaGenerationFirstStorageProviderDefinition);
            _emptyViewDefinition2  = EmptyViewDefinitionObjectMother.Create(SchemaGenerationFirstStorageProviderDefinition);

            _fakeElement1 = MockRepository.GenerateStub <IScriptElement>();
            _fakeElement2 = MockRepository.GenerateStub <IScriptElement>();
            _fakeElement3 = MockRepository.GenerateStub <IScriptElement>();
        }
 public TestableSqlStorageObjectFactory(
     TableScriptBuilder tableBuilder,
     ViewScriptBuilder viewBuilder,
     ForeignKeyConstraintScriptBuilder constraintBuilder,
     IndexScriptBuilder indexBuilder,
     SynonymScriptBuilder synonymBuilder)
 {
     _indexBuilder      = indexBuilder;
     _constraintBuilder = constraintBuilder;
     _viewBuilder       = viewBuilder;
     _tableBuilder      = tableBuilder;
     _synonymBuilder    = synonymBuilder;
 }
예제 #3
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();
        ViewScriptBuilder scriptBuilder = (ViewScriptBuilder)target;

        if (GUILayout.Button("生成View脚本"))
        {
            //mapDataSave.SetMapData();
            scriptBuilder.CreatViewScripts();
        }
        if (GUILayout.Button("生成Module整体脚本"))
        {
            //此处是把脚本生成到Asset资源外
            //mapDataSave.SaveJsonData();
            scriptBuilder.CreatModuleScripts();
        }
    }
        public void SetUp()
        {
            _rdbmsProviderDefinition         = new RdbmsProviderDefinition("TestDomain", new SqlStorageObjectFactory(), "ConnectionString");
            _sqlProviderFactory              = new SqlStorageObjectFactory();
            _persistenceExtensionStub        = MockRepository.GenerateStub <IPersistenceExtension>();
            _storageProviderDefinitionFinder = new StorageGroupBasedStorageProviderDefinitionFinder(DomainObjectsConfiguration.Current.Storage);

            _tableBuilderStub = MockRepository.GenerateStub <TableScriptBuilder> (
                MockRepository.GenerateStub <ITableScriptElementFactory>(), new SqlCommentScriptElementFactory());
            _viewBuilderStub = MockRepository.GenerateStub <ViewScriptBuilder> (
                MockRepository.GenerateStub <IViewScriptElementFactory <TableDefinition> >(),
                MockRepository.GenerateStub <IViewScriptElementFactory <UnionViewDefinition> >(),
                MockRepository.GenerateStub <IViewScriptElementFactory <FilterViewDefinition> >(),
                MockRepository.GenerateStub <IViewScriptElementFactory <EmptyViewDefinition> >(),
                new SqlCommentScriptElementFactory());
            _constraintBuilderStub =
                MockRepository.GenerateStub <ForeignKeyConstraintScriptBuilder> (
                    MockRepository.GenerateStub <IForeignKeyConstraintScriptElementFactory>(), new SqlCommentScriptElementFactory());
            _indexScriptElementFactoryStub = MockRepository.GenerateStub <SqlIndexScriptElementFactory> (
                MockRepository.GenerateStub <ISqlIndexDefinitionScriptElementFactory <SqlIndexDefinition> >(),
                MockRepository.GenerateStub <ISqlIndexDefinitionScriptElementFactory <SqlPrimaryXmlIndexDefinition> >(),
                MockRepository.GenerateStub <ISqlIndexDefinitionScriptElementFactory <SqlSecondaryXmlIndexDefinition> >());
            _indexBuilderStub   = MockRepository.GenerateStub <IndexScriptBuilder> (_indexScriptElementFactoryStub, new SqlCommentScriptElementFactory());
            _synonymBuilderStub =
                MockRepository.GenerateStub <SynonymScriptBuilder> (
                    MockRepository.GenerateStub <ISynonymScriptElementFactory <TableDefinition> >(),
                    MockRepository.GenerateStub <ISynonymScriptElementFactory <UnionViewDefinition> >(),
                    MockRepository.GenerateStub <ISynonymScriptElementFactory <FilterViewDefinition> >(),
                    MockRepository.GenerateStub <ISynonymScriptElementFactory <EmptyViewDefinition> >(),
                    new SqlCommentScriptElementFactory());
            _rdbmsPersistenceModelProviderStub  = MockRepository.GenerateStub <IRdbmsPersistenceModelProvider>();
            _storageTypeInformationProviderStub = MockRepository.GenerateStub <IStorageTypeInformationProvider>();
            _dbCommandBuilderFactoryStub        = MockRepository.GenerateStub <IDbCommandBuilderFactory>();
            MockRepository.GeneratePartialMock <SqlSynonymScriptElementFactory>();
            _storageNameProviderStub = MockRepository.GenerateStub <IStorageNameProvider>();
            _infrastructureStoragePropertyDefinitionProviderStub = MockRepository.GenerateStub <IInfrastructureStoragePropertyDefinitionProvider>();
            _dataStoragePropertyDefinitionFactoryStub            = MockRepository.GenerateStub <IDataStoragePropertyDefinitionFactory>();
            _valueStoragePropertyDefinitonFactoryStub            = MockRepository.GenerateStub <IValueStoragePropertyDefinitionFactory>();
            _relationStoragePropertyDefiniitonFactoryStub        = MockRepository.GenerateStub <IRelationStoragePropertyDefinitionFactory>();
            _methodCallTransformerProviderStub  = MockRepository.GenerateStub <IMethodCallTransformerProvider>();
            _resultOpertatorHandlerRegistryStub = MockRepository.GeneratePartialMock <ResultOperatorHandlerRegistry>();
            _sqlQueryGeneratorStub = MockRepository.GenerateStub <ISqlQueryGenerator>();
            _foreignKeyConstraintDefinitionFactoryStub = MockRepository.GenerateStub <IForeignKeyConstraintDefinitionFactory>();
            _storagePropertyDefinitionResolverStub     = MockRepository.GenerateStub <IStoragePropertyDefinitionResolver>();
        }