private async Task DatabaseTeardown()
        {
            var connection = GetRequiredService <IDbConnectionFactory>()
                             .CreateConnection();

            await connection.ExecuteAsync(TestType1.DropTableScript());

            await connection.ExecuteAsync(TestType2.DropTableScript());

            await connection.ExecuteAsync(TestType3.DropTableScript());

            await connection.ExecuteAsync(TestType4.DropTableScript());

            await connection.ExecuteAsync(TestType5.DropTableScript());

            await connection.ExecuteAsync(TestType6.DropTableScript());

            await connection.ExecuteAsync(TestType7.DropTableScript());

            await connection.ExecuteAsync(TestType8.DropTableScript());

            await connection.ExecuteAsync(TestType9.DropTableScript());

            await connection.ExecuteAsync(TestType10.DropTableScript());

            await connection.ExecuteAsync(TestType11.DropTableScript());

            await connection.ExecuteAsync(TestType12.DropTableScript());

            await connection.ExecuteAsync(TestType13.DropTableScript());

            await connection.ExecuteAsync(TestType14.DropTableScript());
        }
        private async Task DatabaseSetUp()
        {
            var connection = GetRequiredService <IDbConnectionFactory>()
                             .CreateConnection();

            await connection.ExecuteAsync(TestType1.CreateTableScript());

            await connection.ExecuteAsync(TestType2.CreateTableScript());

            await connection.ExecuteAsync(TestType3.CreateTableScript());

            await connection.ExecuteAsync(TestType4.CreateTableScript());

            await connection.ExecuteAsync(TestType5.CreateTableScript());

            await connection.ExecuteAsync(TestType6.CreateTableScript());

            await connection.ExecuteAsync(TestType7.CreateTableScript());

            await connection.ExecuteAsync(TestType8.CreateTableScript());

            await connection.ExecuteAsync(TestType9.CreateTableScript());

            await connection.ExecuteAsync(TestType10.CreateTableScript());

            await connection.ExecuteAsync(TestType11.CreateTableScript());

            await connection.ExecuteAsync(TestType12.CreateTableScript());

            await connection.ExecuteAsync(TestType13.CreateTableScript());

            await connection.ExecuteAsync(TestType14.CreateTableScript());
        }
Esempio n. 3
0
        public async Task ShouldInsert()
        {
            var conn = GetRequiredService <IDbConnectionFactory>()
                       .CreateConnection();

            var givenData = Fixture.Create <string>();
            var item      = new TestType5()
            {
                Data = givenData
            };

            await conn.InsertAsync(item);

            var retrievedItem = await conn.QueryFirstAsync <TestType5>(
                @"select MyData as Data 
                      from TestType5");

            item.Data.Should().Be(givenData);
            retrievedItem.Data.Should().Be(item.Data);
        }