Exemplo n.º 1
0
        public SqlIndexScriptElementFactory(
            ISqlIndexDefinitionScriptElementFactory <SqlIndexDefinition> indexDefinitionElmementFactory,
            ISqlIndexDefinitionScriptElementFactory <SqlPrimaryXmlIndexDefinition> primaryIndexDefinitionElementFactory,
            ISqlIndexDefinitionScriptElementFactory <SqlSecondaryXmlIndexDefinition> secondaryIndexDefinitionElementFactory)
        {
            ArgumentUtility.CheckNotNull("indexDefinitionElmementFactory", indexDefinitionElmementFactory);
            ArgumentUtility.CheckNotNull("primaryIndexDefinitionElementFactory", primaryIndexDefinitionElementFactory);
            ArgumentUtility.CheckNotNull("secondaryIndexDefinitionElementFactory", secondaryIndexDefinitionElementFactory);

            _indexDefinitionElementFactory          = indexDefinitionElmementFactory;
            _primaryIndexDefinitionElementFactory   = primaryIndexDefinitionElementFactory;
            _secondaryIndexDefinitionElementFactory = secondaryIndexDefinitionElementFactory;
        }
        public override void SetUp()
        {
            base.SetUp();

            _indexDefinitionElementFactoryMock          = MockRepository.GenerateStub <ISqlIndexDefinitionScriptElementFactory <SqlIndexDefinition> >();
            _primaryIndexDefinitionElementFactoryMock   = MockRepository.GenerateStub <ISqlIndexDefinitionScriptElementFactory <SqlPrimaryXmlIndexDefinition> > ();
            _secondaryIndexDefinitionElementFactoryMock =
                MockRepository.GenerateStub <ISqlIndexDefinitionScriptElementFactory <SqlSecondaryXmlIndexDefinition> >();

            _factory = new SqlIndexScriptElementFactory(
                _indexDefinitionElementFactoryMock, _primaryIndexDefinitionElementFactoryMock, _secondaryIndexDefinitionElementFactoryMock);

            var simpleColumn  = ColumnDefinitionObjectMother.CreateColumn("Column");
            var indexedColumn = new SqlIndexedColumnDefinition(simpleColumn, IndexOrder.Desc);

            _entityNameDefinition     = new EntityNameDefinition(null, "Table");
            _indexDefinition          = new SqlIndexDefinition("Index1", new[] { indexedColumn });
            _primaryIndexDefinition   = new SqlPrimaryXmlIndexDefinition("Index2", simpleColumn);
            _secondaryIndexDefinition = new SqlSecondaryXmlIndexDefinition(
                "Index3", simpleColumn, "PrimaryIndexName", SqlSecondaryXmlIndexKind.Property);

            _fakeScriptElement = MockRepository.GenerateStub <IScriptElement>();
        }