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>();
        }
Example #2
0
        public override void SetUp()
        {
            base.SetUp();

            _factory = new SqlFilterViewScriptElementFactory();

            var tableDefinitionWithCustomSchema = TableDefinitionObjectMother.Create(
                SchemaGenerationFirstStorageProviderDefinition,
                new EntityNameDefinition("SchemaName", "TableName1"));
            var tableDefinitionWithDefaultSchema = TableDefinitionObjectMother.Create(
                SchemaGenerationFirstStorageProviderDefinition,
                new EntityNameDefinition(null, "TableName2"));

            var property1 = SimpleStoragePropertyDefinitionObjectMother.CreateStorageProperty("Column1");
            var property2 = SimpleStoragePropertyDefinitionObjectMother.CreateStorageProperty("Column2");

            _filterViewDefinitionWithCustomSchema = FilterViewDefinitionObjectMother.Create(
                SchemaGenerationFirstStorageProviderDefinition,
                new EntityNameDefinition("SchemaName", "FilterView1"),
                tableDefinitionWithCustomSchema,
                new[] { "ClassID1" },
                ObjectIDStoragePropertyDefinitionObjectMother.ObjectIDProperty,
                SimpleStoragePropertyDefinitionObjectMother.TimestampProperty,
                new[] { property1 });
            _filterViewDefinitionWithDefaultSchema = FilterViewDefinitionObjectMother.Create(
                SchemaGenerationFirstStorageProviderDefinition,
                new EntityNameDefinition(null, "FilterView2"),
                tableDefinitionWithDefaultSchema,
                new[] { "ClassID1", "ClassID2" },
                ObjectIDStoragePropertyDefinitionObjectMother.ObjectIDProperty,
                SimpleStoragePropertyDefinitionObjectMother.TimestampProperty,
                new[] { property1, property2 });
        }
Example #3
0
        public IScriptElement GetDropElement(FilterViewDefinition filterViewDefinition, EntityNameDefinition synonymName)
        {
            ArgumentUtility.CheckNotNull("filterViewDefinition", filterViewDefinition);
            ArgumentUtility.CheckNotNull("synonymName", synonymName);

            return(GetSynonymDropScriptStatement(synonymName));
        }
        public override void SetUp()
        {
            base.SetUp();

            _indexScriptElementFactoryStub = MockRepository.GenerateStub <IIndexScriptElementFactory>();

            _builder = new IndexScriptBuilder(_indexScriptElementFactoryStub, new SqlCommentScriptElementFactory());

            _indexDefinition1 = MockRepository.GenerateStub <IIndexDefinition>();
            _indexDefinition2 = MockRepository.GenerateStub <IIndexDefinition>();
            _indexDefinition3 = MockRepository.GenerateStub <IIndexDefinition>();

            _tableDefinition1 = TableDefinitionObjectMother.CreateWithIndexes(
                SchemaGenerationFirstStorageProviderDefinition,
                new[] { _indexDefinition1 });
            _tableDefinition2 = TableDefinitionObjectMother.CreateWithIndexes(
                SchemaGenerationFirstStorageProviderDefinition,
                new[] { _indexDefinition2, _indexDefinition3 });
            _unionViewDefinition1 = UnionViewDefinitionObjectMother.CreateWithIndexes(
                SchemaGenerationFirstStorageProviderDefinition,
                new[] { _indexDefinition1 });
            _unionViewDefinition2 = UnionViewDefinitionObjectMother.CreateWithIndexes(
                SchemaGenerationFirstStorageProviderDefinition,
                new[] { _indexDefinition2, _indexDefinition3 });
            _filterViewDefinition1 = FilterViewDefinitionObjectMother.CreateWithIndexes(
                SchemaGenerationFirstStorageProviderDefinition,
                new[] { _indexDefinition1 });
            _filterViewDefinition2 = FilterViewDefinitionObjectMother.CreateWithIndexes(
                SchemaGenerationFirstStorageProviderDefinition,
                new[] { _indexDefinition2, _indexDefinition3 });

            _fakeElement1 = MockRepository.GenerateStub <IScriptElement>();
            _fakeElement2 = MockRepository.GenerateStub <IScriptElement>();
            _fakeElement3 = MockRepository.GenerateStub <IScriptElement>();
        }
Example #5
0
        public void SetUp()
        {
            _storageProviderDefinition = new UnitTestStorageProviderStubDefinition("SPID");

            _timestampProperty = SimpleStoragePropertyDefinitionObjectMother.TimestampProperty;
            _objectIDProperty  = ObjectIDStoragePropertyDefinitionObjectMother.ObjectIDProperty;
            _property1         = SimpleStoragePropertyDefinitionObjectMother.CreateStorageProperty("Column1");
            _property2         = SimpleStoragePropertyDefinitionObjectMother.CreateStorageProperty("Column2");
            _property3         = SimpleStoragePropertyDefinitionObjectMother.CreateStorageProperty("Column3");

            _synonyms = new[] { new EntityNameDefinition(null, "Test") };

            _baseEntityDefinition = TableDefinitionObjectMother.Create(_storageProviderDefinition);

            _indexes = new[] { MockRepository.GenerateStub <IIndexDefinition>() };
            _filterViewDefinition = new FilterViewDefinition(
                _storageProviderDefinition,
                new EntityNameDefinition("Schema", "Test"),
                _baseEntityDefinition,
                new[] { "ClassId1", "ClassId2" },
                _objectIDProperty,
                _timestampProperty,
                new[] { _property1, _property2, _property3 },
                _indexes,
                _synonyms);
        }
 private void AddFilterViewDefinition(FilterViewDefinition filterViewDefinition)
 {
     foreach (var synonym in filterViewDefinition.Synonyms)
     {
         AddElements(
             _filterViewElementFactory.GetCreateElement(filterViewDefinition, synonym),
             _filterViewElementFactory.GetDropElement(filterViewDefinition, synonym));
     }
 }
Example #7
0
        public override void SetUp()
        {
            base.SetUp();

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

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

            _synonym1 = new EntityNameDefinition(null, "Synonym1");
            _synonym2 = new EntityNameDefinition(null, "Synonym2");
            _synonym3 = new EntityNameDefinition(null, "Synonym3");

            _tableDefinition1 = TableDefinitionObjectMother.CreateWithSynonyms(
                SchemaGenerationFirstStorageProviderDefinition,
                new[] { _synonym1 });
            _tableDefinition2 = TableDefinitionObjectMother.CreateWithSynonyms(
                SchemaGenerationFirstStorageProviderDefinition,
                new[] { _synonym2, _synonym3 });
            _unionViewDefinition1 = UnionViewDefinitionObjectMother.CreateWithSynonyms(
                SchemaGenerationFirstStorageProviderDefinition,
                new[] { _synonym1 });
            _unionViewDefinition2 = UnionViewDefinitionObjectMother.CreateWithSynonyms(
                SchemaGenerationFirstStorageProviderDefinition,
                new[] { _synonym2, _synonym3 });
            _filterViewDefinition1 = FilterViewDefinitionObjectMother.CreateWithSynonyms(
                SchemaGenerationFirstStorageProviderDefinition,
                new[] { _synonym1 });
            _filterViewDefinition2 = FilterViewDefinitionObjectMother.CreateWithSynonyms(
                SchemaGenerationFirstStorageProviderDefinition,
                new[] { _synonym2, _synonym3 });
            _emptyViewDefinition1 = EmptyViewDefinitionObjectMother.CreateWithSynonyms(
                SchemaGenerationFirstStorageProviderDefinition,
                new[] { _synonym1 });
            _emptyViewDefinition2 = EmptyViewDefinitionObjectMother.CreateWithSynonyms(
                SchemaGenerationFirstStorageProviderDefinition,
                new[] { _synonym2, _synonym3 });

            _fakeElement1 = MockRepository.GenerateStub <IScriptElement>();
            _fakeElement2 = MockRepository.GenerateStub <IScriptElement>();
            _fakeElement3 = MockRepository.GenerateStub <IScriptElement>();
        }
        public override void SetUp()
        {
            base.SetUp();

            _tableDefinition      = TableDefinitionObjectMother.Create(TestDomainStorageProviderDefinition);
            _filterViewDefinition = FilterViewDefinitionObjectMother.Create(
                TestDomainStorageProviderDefinition, new EntityNameDefinition(null, "FilterView"), _tableDefinition);
            _unionViewDefinition = UnionViewDefinitionObjectMother.Create(
                TestDomainStorageProviderDefinition, new EntityNameDefinition(null, "UnionView"), new[] { _tableDefinition });
            _emptyViewDefinition = EmptyViewDefinitionObjectMother.Create(TestDomainStorageProviderDefinition);

            _mockRepository      = new MockRepository();
            _voidReceiverMock    = _mockRepository.StrictMock <IVisitorCallReceiver> ();
            _nonVoidReceiverMock = _mockRepository.StrictMock <IVisitorCallReceiver <string> > ();
        }
Example #9
0
        public void Initialization_ViewNameNull()
        {
            var filterViewDefinition = new FilterViewDefinition(
                _storageProviderDefinition,
                null,
                _baseEntityDefinition,
                new[] { "ClassId" },
                _objectIDProperty,
                _timestampProperty,
                new SimpleStoragePropertyDefinition[0],
                new IIndexDefinition[0],
                new EntityNameDefinition[0]);

            Assert.That(filterViewDefinition.ViewName, Is.Null);
        }
Example #10
0
        public void GetBaseTable_IndirectTable()
        {
            var derivedFilterViewDefinition = new FilterViewDefinition(
                _storageProviderDefinition,
                new EntityNameDefinition(null, "Test"),
                _filterViewDefinition,
                new[] { "x" },
                _objectIDProperty,
                _timestampProperty,
                new SimpleStoragePropertyDefinition[0],
                new IIndexDefinition[0],
                new EntityNameDefinition[0]);

            var table = derivedFilterViewDefinition.GetBaseTable();

            Assert.That(table, Is.SameAs(_baseEntityDefinition));
        }
        public void Initialization_WithInvalidUnionedEntity()
        {
            var filterViewDefinition = new FilterViewDefinition(
                _storageProviderDefinition,
                new EntityNameDefinition(null, "ViewName"),
                _tableDefinition1,
                new[] { "x" },
                _objectIDProperty,
                _timestampProperty,
                new SimpleStoragePropertyDefinition[0],
                new IIndexDefinition[0],
                new EntityNameDefinition[0]);

            new UnionViewDefinition(
                _storageProviderDefinition,
                null,
                new[] { filterViewDefinition },
                _objectIDProperty,
                _timestampProperty,
                new SimpleStoragePropertyDefinition[0],
                new IIndexDefinition[0],
                new EntityNameDefinition[0]);
        }
        public override void SetUp()
        {
            base.SetUp();

            _factory = new SqlSynonymScriptElementFactory();

            _tableDefinition1 = TableDefinitionObjectMother.Create(
                SchemaGenerationFirstStorageProviderDefinition,
                new EntityNameDefinition("SchemaName", "TableName1"));
            _tableDefinition2 = TableDefinitionObjectMother.Create(
                SchemaGenerationFirstStorageProviderDefinition,
                new EntityNameDefinition(null, "TableName2"));

            _unionViewDefinition1 = UnionViewDefinitionObjectMother.Create(
                SchemaGenerationFirstStorageProviderDefinition,
                new EntityNameDefinition("SchemaName", "UnionView1"));
            _unionViewDefinition2 = UnionViewDefinitionObjectMother.Create(
                SchemaGenerationFirstStorageProviderDefinition,
                new EntityNameDefinition(null, "UnionView2"));

            _filterViewDefinition1 = FilterViewDefinitionObjectMother.Create(
                SchemaGenerationFirstStorageProviderDefinition,
                new EntityNameDefinition("SchemaName", "FilterView1"));
            _filterViewDefinition2 = FilterViewDefinitionObjectMother.Create(
                SchemaGenerationFirstStorageProviderDefinition,
                new EntityNameDefinition(null, "FilterView2"));

            _emptyViewDefinition1 = EmptyViewDefinitionObjectMother.Create(
                SchemaGenerationFirstStorageProviderDefinition,
                new EntityNameDefinition("SchemaName", "EmptyView1"));
            _emptyViewDefinition2 = EmptyViewDefinitionObjectMother.Create(
                SchemaGenerationFirstStorageProviderDefinition,
                new EntityNameDefinition(null, "EmptyView2"));

            _synonymWithCustomSchema  = new EntityNameDefinition("SynonymSchemaName", "Synonym1");
            _synonymWithDefaultSchema = new EntityNameDefinition(null, "Synonym2");
        }
 protected override bool UseSchemaBinding(FilterViewDefinition entityDefinition)
 {
     return(false);
 }
Example #14
0
            public void VisitFilterViewDefinition(FilterViewDefinition filterViewDefinition)
            {
                ArgumentUtility.CheckNotNull("filterViewDefinition", filterViewDefinition);

                _returnValue = _filterViewDefinitionHandler(filterViewDefinition, ContinueWithNextEntity);
            }
Example #15
0
 private void AddFilterViewDefinition(FilterViewDefinition filterViewDefinition)
 {
     AddElements(_filterViewElementFactory.GetCreateElement(filterViewDefinition), _filterViewElementFactory.GetDropElement(filterViewDefinition));
 }