コード例 #1
0
        public void write_csv_ignores_properties_marked_with_csv_ignore_attribute()
        {
            using (var stringWriter = new StringWriter())
                using (var writer = new CsvWriter(stringWriter))
                {
                    writer.NewLine = "<EOL>";

                    var items = new TestType3[]
                    {
                        new TestType3
                        {
                            Property1 = "1",
                            Property2 = "2",
                            Property3 = 3,
                        },
                        new TestType3
                        {
                            Property1 = "4",
                            Property2 = "5",
                            Property3 = 6,
                        }
                    };

                    items.WriteCsv(writer);
                    Assert.Equal("Property1<EOL>1<EOL>4<EOL>", stringWriter.ToString());
                }
        }
コード例 #2
0
        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());
        }
コード例 #3
0
        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());
        }
コード例 #4
0
        public void write_csv_ignores_properties_marked_with_csv_ignore_attribute()
        {
            using (var stringWriter = new StringWriter())
            using (var writer = new CsvWriter(stringWriter))
            {
                writer.NewLine = "<EOL>";

                var items = new TestType3[]
                {
                    new TestType3
                    {
                        Property1 = "1",
                        Property2 = "2",
                        Property3 = 3,
                    },
                    new TestType3
                    {
                        Property1 = "4",
                        Property2 = "5",
                        Property3 = 6,
                    }
                };

                items.WriteCsv(writer);
                Assert.Equal("Property1<EOL>1<EOL>4<EOL>", stringWriter.ToString());
            }
        }