Esempio n. 1
0
        public void CallingIncludeAddsNewIncludeToExpression()
        {
            var collectionMock = new Mock <IList <IndexIncludeDefinition> >();

            var additionalFeatures = new Dictionary <string, object>()
            {
                [SqlServerExtensions.IncludesList] = collectionMock.Object
            };

            var indexMock = new Mock <IndexDefinition>();

            indexMock.Setup(x => x.AdditionalFeatures).Returns(additionalFeatures);

            var expressionMock = new Mock <CreateIndexExpression>();

            expressionMock.SetupGet(e => e.Index).Returns(indexMock.Object);

            ICreateIndexOnColumnOrInSchemaSyntax builder = new CreateIndexExpressionBuilder(expressionMock.Object);

            SqlServerExtensions.Include(builder, "BaconId");

            collectionMock.Verify(x => x.Add(It.Is <IndexIncludeDefinition>(c => c.Name.Equals("BaconId"))));
            indexMock.VerifyGet(x => x.AdditionalFeatures);
            expressionMock.VerifyGet(e => e.Index);
        }
 /// <summary>
 /// Ensures that the database specified in the connection string exists.
 /// </summary>
 /// <param name="supported">Fluent helper type.</param>
 /// <param name="connectionString">The connection string.</param>
 /// <param name="commandTimeout">Use this to set the command time out for creating a database in case you're encountering a time out in this operation.</param>
 /// <returns></returns>
 public static void AzureSqlDwDatabase(this SupportedDatabasesForEnsureDatabase supported, string connectionString, int commandTimeout)
 {
     SqlServerExtensions.SqlDatabase(supported, connectionString, new ConsoleUpgradeLog(), commandTimeout);
 }