From ca4b5abf0df7b4e76bfec3d5fb1faafa186928b4 Mon Sep 17 00:00:00 2001 From: Sal Date: Wed, 30 Aug 2023 05:28:54 -0400 Subject: [PATCH] fix unit test --- src/ParquetViewer.Tests/SanityTests.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/ParquetViewer.Tests/SanityTests.cs b/src/ParquetViewer.Tests/SanityTests.cs index 1e67292..1630934 100644 --- a/src/ParquetViewer.Tests/SanityTests.cs +++ b/src/ParquetViewer.Tests/SanityTests.cs @@ -186,6 +186,11 @@ public async Task AMPLITUDE_EVENT_TEST() RegularProperty = "yyy" }; + var isSelfContainedExecutable = false; +#if Release_SelfContained + isSelfContainedExecutable = true; +#endif + string expectedRequestJson = @$" {{ ""api_key"": ""dummy"", @@ -199,7 +204,8 @@ public async Task AMPLITUDE_EVENT_TEST() ""autoSizeColumnsMode"": ""{AppSettings.AutoSizeColumnsMode}"", ""dateTimeDisplayFormat"": ""{AppSettings.DateTimeDisplayFormat}"", ""systemMemory"": {(int)(GC.GetGCMemoryInfo().TotalAvailableMemoryBytes / 1048576.0 /*magic number*/)}, - ""processorCount"": {Environment.ProcessorCount} + ""processorCount"": {Environment.ProcessorCount}, + ""selfContainedExecutable"": {(isSelfContainedExecutable ? "true" : "false")} }}, ""event_properties"": {{ ""regularProperty"": ""yyy"" @@ -218,6 +224,10 @@ public async Task AMPLITUDE_EVENT_TEST() { //Verify the request we're sending is what we expect it to be string requestJsonBody = await (request.Content?.ReadAsStringAsync() ?? Task.FromResult(string.Empty)); + + var a = Regex.Replace(requestJsonBody, "\\s", string.Empty); + var b = Regex.Replace(expectedRequestJson, "\\s", string.Empty); + if (Regex.Replace(requestJsonBody, "\\s", string.Empty) .Equals(Regex.Replace(expectedRequestJson, "\\s", string.Empty))) return new HttpResponseMessage(System.Net.HttpStatusCode.OK); @@ -248,7 +258,7 @@ public async Task NULLABLE_GUID_TEST1() public async Task MALFORMED_DATETIME_TEST1() { using var parquetEngine = await ParquetEngine.OpenFileOrFolderAsync("Data/MALFORMED_DATETIME_TEST1.parquet", default); - + var dataTable = await parquetEngine.ReadRowsAsync(parquetEngine.Fields, 0, int.MaxValue, default); Assert.Equal(typeof(DateTime), dataTable.Rows[0]["ds"]?.GetType());