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 IScriptElement GetDropElement(EmptyViewDefinition emptyViewDefinition, EntityNameDefinition synonymName)
        {
            ArgumentUtility.CheckNotNull("emptyViewDefinition", emptyViewDefinition);
            ArgumentUtility.CheckNotNull("synonymName", synonymName);

            return(GetSynonymDropScriptStatement(synonymName));
        }
 private void AddEmptyViewDefinition(EmptyViewDefinition emptyViewDefinition)
 {
     foreach (var synonym in emptyViewDefinition.Synonyms)
     {
         AddElements(
             _emptyViewElementFactory.GetCreateElement(emptyViewDefinition, synonym),
             _emptyViewElementFactory.GetDropElement(emptyViewDefinition, synonym));
     }
 }
        public void SetUp()
        {
            _validationRule          = new ClassAboveTableIsAbstractValidationRule();
            _abstractClassDefinition = ClassDefinitionObjectMother.CreateClassDefinition(classType: typeof(DerivedValidationDomainObjectClass), isAbstract: true);
            _concreteClassDefinition = ClassDefinitionObjectMother.CreateClassDefinition(classType: typeof(DerivedValidationDomainObjectClass), isAbstract: false);
            var storageProviderDefinition = new UnitTestStorageProviderStubDefinition("DefaultStorageProvider");

            _tableDefinition     = TableDefinitionObjectMother.Create(storageProviderDefinition, new EntityNameDefinition(null, "TableName"));
            _unionViewDefinition = UnionViewDefinitionObjectMother.Create(storageProviderDefinition);
            _emptyViewDefinition = EmptyViewDefinitionObjectMother.Create(storageProviderDefinition);
        }
Example #5
0
        public void Initialization_ViewNameNull()
        {
            var emptyViewDefinition = new EmptyViewDefinition(
                _storageProviderDefinition,
                null,
                _objectIDProperty,
                _timestampProperty,
                new SimpleStoragePropertyDefinition[0],
                new EntityNameDefinition[0]);

            Assert.That(emptyViewDefinition.ViewName, Is.Null);
        }
Example #6
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 #8
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("Schema", "Test") };
            _emptyViewDefinition = new EmptyViewDefinition(
                _storageProviderDefinition,
                new EntityNameDefinition("Schema", "Test"),
                _objectIDProperty,
                _timestampProperty,
                new[] { _property1, _property2, _property3 },
                _synonyms);
        }
Example #9
0
        public override void SetUp()
        {
            base.SetUp();

            _factory = new SqlEmptyViewScriptElementFactory();

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

            _emptyViewDefinitionWithCustomSchema = EmptyViewDefinitionObjectMother.Create(
                SchemaGenerationFirstStorageProviderDefinition,
                new EntityNameDefinition("SchemaName", "EmptyView1"),
                ObjectIDStoragePropertyDefinitionObjectMother.ObjectIDProperty,
                SimpleStoragePropertyDefinitionObjectMother.TimestampProperty,
                new[] { property1 });
            _emptyViewDefinitionWithDefaultSchema = EmptyViewDefinitionObjectMother.Create(
                SchemaGenerationFirstStorageProviderDefinition,
                new EntityNameDefinition(null, "EmptyView2"),
                ObjectIDStoragePropertyDefinitionObjectMother.ObjectIDProperty,
                SimpleStoragePropertyDefinitionObjectMother.TimestampProperty,
                new[] { property1, property2 });
        }
        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");
        }
Example #11
0
            public void VisitEmptyViewDefinition(EmptyViewDefinition emptyViewDefinition)
            {
                ArgumentUtility.CheckNotNull("emptyViewDefinition", emptyViewDefinition);

                _returnValue = _emptyViewDefinitionHandler(emptyViewDefinition, ContinueWithNextEntity);
            }
Example #12
0
 private void AddEmptyViewDefinition(EmptyViewDefinition emptyViewDefinition)
 {
     AddElements(_emptyViewElementFactory.GetCreateElement(emptyViewDefinition), _emptyViewElementFactory.GetDropElement(emptyViewDefinition));
 }