Exemple #1
0
        public async Task ShouldVerifySameTableTurkishAsync()
        {
            //NH-3063

            // Turkish have unusual casing rules for the letter 'i'. This test verifies that
            // code paths executed by the SchemaValidator correctly handles case insensitive
            // comparisons for this.

            // Just make sure that we have an int property in the mapped class. This is
            // the 'i' we rely on for the test.
            var v = new Version();

            Assert.That(v.Id, Is.TypeOf <int>());

            var cfg = BuildConfiguration(_version1Resource);

            var export = new SchemaExport(cfg);

            await(export.CreateAsync(true, true));
            try
            {
                var validator = new Tool.hbm2ddl.SchemaValidator(cfg);
                await(validator.ValidateAsync());
            }
            finally
            {
                await(export.DropAsync(true, true));
            }
        }
Exemple #2
0
        public async Task TearDown()
        {
            await schemaExport.DropAsync(false, true);

            if (dbSchemaName != null)
            {
                await DropDbSchema();
            }
        }
        public async Task SchemaExport_Drop_CreatesDropScriptAsync()
        {
            Configuration configuration = GetConfiguration();
            SchemaExport  export        = new SchemaExport(configuration);
            TextWriter    tw            = new StringWriter();

            await(export.DropAsync(tw, false));
            string s = tw.ToString();

            var dialect = Dialect.Dialect.GetDialect(configuration.Properties);

            if (dialect.SupportsIfExistsBeforeTableName)
            {
                Assert.IsTrue(s.Contains("drop table if exists Home_Drop"));
                Assert.IsTrue(s.Contains("drop table if exists Home_All"));
            }
            else
            {
                Assert.IsTrue(s.Contains("drop table Home_Drop"));
                Assert.IsTrue(s.Contains("drop table Home_All"));
            }
        }
        public DatabaseFixture()
        {
            var databaseFileName = $"InstaLikeTestDb-{Guid.NewGuid()}.sqlite";

            SessionFactory = Fluently.Configure()
                             .Database(
                SQLiteConfiguration.Standard
                .ConnectionString(BuildTestDatabaseConnectionString(databaseFileName))
                .AdoNetBatchSize(20)
                .ShowSql()
                .FormatSql()
                .UseReflectionOptimizer()
                )
                             .Mappings(m =>
                                       m.FluentMappings
                                       .Conventions.Add(
                                           DefaultLazy.Always(),
                                           DynamicInsert.AlwaysTrue(),
                                           DynamicUpdate.AlwaysTrue(),
                                           new AssociationsMappingConvention(),
                                           new DateTimeOffsetTypeConvention()
                                           )
                                       .Add <UserMapping>()
                                       .Add <FollowMapping>()
                                       .Add <PostMapping>()
                                       .Add <CommentMapping>()
                                       .Add <LikeMapping>()
                                       .Add <NotificationMapping>()
                                       )
                             .ExposeConfiguration(async cfg =>
            {
                var schemaExport = new SchemaExport(cfg);
                schemaExport.SetOutputFile($"{databaseFileName}_Schema.sql");
                await schemaExport.DropAsync(true, true);
                await schemaExport.CreateAsync(true, true);
            })
                             .BuildSessionFactory();
        }
 public Task TearDown() => schema.DropAsync(false, true);
Exemple #6
0
        public async Task TearDown()
        {
            await sessionFactory.CloseAsync();

            await schema.DropAsync(false, true);
        }