I have a csv file with the split character as ;
and the decimal Separator as ,
. I use the csv file in my Unit Tests (NUnit Framework) for assertions. The issue is that my development machine has ,
as decimal separator and Server has .
as decimal separator. For example 1,314
becomes 1314
in my server and the assertions fail in the test. Is there a solid solution for this? Below is a snippet showing how I read from .csv file, and store in a DataTable table
using (StreamReader reader = new StreamReader(filePath))
{
while (!reader.EndOfStream)
{
string[] rows = reader.ReadLine().Split(';');
DataRow dataRow = table.NewRow();
for (int i = 0; i < headers.Length; i++)
{
dataRow[i] = rows[i];
}
table.Rows.Add(dataRow);
}
}
And an example of assertion, where expectedResultTable is a result of Reading the csv file into a DataTable.
Assert.AreEqual(Math.Round(Convert.ToDouble(expectedResultTable.Rows[1]["DATA2"]), 2), Math.Round(manuversResult[1].Amplitude,2));