Exemple #1
0
        public void RoundtripTable()
        {
            // Test that if we download and then reupload, it's ok.
            var account = GetStorage();

            var       source   = from x in Enumerable.Range(1, 200) select new { N = x, N2 = x * x };
            DataTable dtSource = DataTable.New.FromEnumerable(source);

            string tableName = "csvtesttable";

            dtSource.SaveToAzureTable(account, tableName); // original upload

            DataTable        dtDownload1 = DataTable.New.ReadAzureTableLazy(account, tableName);
            MutableDataTable dtA         = DataTable.New.GetMutableCopy(dtDownload1);

            // this writes back to the source that dtDownload1 was streaming from.
            // But we already copied to dtA, so safe to overwrite.
            dtA.SaveToAzureTable(account, tableName); // 2nd upload

            DataTable        dtDownload2 = DataTable.New.ReadAzureTableLazy(account, tableName);
            MutableDataTable dtB         = DataTable.New.GetMutableCopy(dtDownload2);

            // Everything except timestamps should match.
            dtA.DeleteColumns("TimeStamp");
            dtB.DeleteColumns("TimeStamp");
            Utility.AssertEquals(dtA, dtB);
        }