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());
        }
        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());
        }
Exemplo n.º 3
0
        public async Task ShouldInsertTestType11()
        {
            var conn = GetRequiredService <IDbConnectionFactory>()
                       .CreateConnection();

            var givenId = Fixture.Create <int>();
            var item    = new TestType11
            {
                Id   = givenId,
                Data = Fixture.Create <string>()
            };

            await conn.InsertAsync(item);

            item.Id.Should().Be(givenId);

            var retrievedItem = (await conn
                                 .GetAll <TestType11>())
                                .First();

            retrievedItem.Should().BeEquivalentTo(item);
        }