From a805bb5a45172c2243172c1c6a4420d4f471e056 Mon Sep 17 00:00:00 2001 From: Jes Bak Hansen Date: Fri, 4 Jun 2021 09:28:42 +0200 Subject: [PATCH] Fixes 3 By specifying the invariant culture the tests are able to parse the DateTimes correctly and run to completion, irregardless of how the local systems Culture is configured. --- src/FileIO/WithAsyncStreams.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/FileIO/WithAsyncStreams.cs b/src/FileIO/WithAsyncStreams.cs index 2b004fa..15f99a8 100644 --- a/src/FileIO/WithAsyncStreams.cs +++ b/src/FileIO/WithAsyncStreams.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.IO; using System.Linq; using System.Threading.Tasks; @@ -38,7 +39,7 @@ public async Task> ProcessStreamAsync(string filePath) { Name = employeeLine[0], Email = employeeLine[1], - DateOfJoining = Convert.ToDateTime(employeeLine[2]), + DateOfJoining = Convert.ToDateTime(employeeLine[2], CultureInfo.InvariantCulture.DateTimeFormat), Salary = Convert.ToDouble(employeeLine[3]), Age = Convert.ToInt16(employeeLine[4]) })