public void TestF()
        {
            var columnA = new USqlColumn <string>("A");
            var columnB = new USqlColumn <string>("B");
            var columns = new List <IColumn> {
                columnA, columnB
            };
            var schema = new USqlSchema(columns);
            var row1   = new USqlRow(schema, new object[] { "1111", new SqlArray <string> {
                                                            } });
            var row2   = new USqlRow(schema, new object[] { "1111", null });
            var row3   = new USqlRow(schema, new object[] { "2222", new SqlArray <string>(new[] { "a" }) });

            using (var f = File.Create(@"C:\code\notebooks\data\avro\tmp-avrooutputter\avrooutputtertest1.avro"))
            {
                var sw = new USqlStreamWriter(f);

                var outputter = new AvroOutputter(@"{""type"":""record"",""name"":""Microsoft.Streaming.Avro.GenericFromIRecord0"",""fields"":[{""name"":""A"",""type"":[""null"",""string""]},{""name"": ""B"", ""type"": [""null"", {""type"" : ""array"", ""items"" : ""string""}]}]}");
                outputter.Output(row1, sw);
                outputter.Output(row2, sw);
                outputter.Output(row3, sw);
                outputter.Close();
                sw.Close();
            }
        }
Beispiel #2
0
 public void TestMyOutputter()
 {
     using (FileStream stream = new FileStream(@"output.txt", FileMode.OpenOrCreate))
     {
         USqlStreamWriter writer    = new USqlStreamWriter(stream);
         MyOutputter      outputter = new MyOutputter();
         outputter.Output(RowGenerator(), writer);
     }
     //Make sure the file is there
     Assert.IsTrue(File.Exists(@"output.txt"));
     //Make sure the output content is as expected.
     Assert.IsTrue(FileEquals(@"output.txt", @"output_baseline.txt"));
 }