Skip to content

Commit

Permalink
fix WorkUnitRowCsvFileSerializerTests
Browse files Browse the repository at this point in the history
  • Loading branch information
harlam357 committed Nov 7, 2021
1 parent 238a6ba commit 96be338
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions src/HFM.Core.Tests/Data/WorkUnitRowCsvFileSerializerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,47 +11,47 @@ namespace HFM.Core.Data
[TestFixture]
public class WorkUnitRowCsvFileSerializerTests
{
private List<WorkUnitRow> _value;
private string _expected;

[SetUp]
public void BeforeEach()
{
// Arrange
_value = new List<WorkUnitRow> { new WorkUnitRow() };
_expected = "DatabaseID,ProjectID,ProjectRun,ProjectClone,ProjectGen,Name,Path,Username,Team,CoreVersion,FramesCompleted,FrameTime,Result,Assigned,Finished,WorkUnitName,KFactor,Core,Frames,Atoms,PreferredDays,MaximumDays,SlotType,PPD,Credit,BaseCredit";
_expected += Environment.NewLine;
_expected += "0,0,0,0,0,,,,0,0,0,00:00:00,,01/01/0001 00:00:00,01/01/0001 00:00:00,,0,,0,0,0,0,,0,0,0";
_expected += Environment.NewLine;
}

[Test]
public void WorkUnitRowCsvFileSerializer_Serialize_UsingCurrentCulture_Test()
{
// Arrange
var value = new List<WorkUnitRow>();
value.Add(new WorkUnitRow());
string expected = "DatabaseID,ProjectID,ProjectRun,ProjectClone,ProjectGen,Name,Path,Username,Team,CoreVersion,FramesCompleted,FrameTime,Result,Assigned,Finished,WorkUnitName,KFactor,Core,Frames,Atoms,PreferredDays,MaximumDays,SlotType,PPD,Credit";
expected += Environment.NewLine;
expected += "0,0,0,0,0,,,,0,0,0,00:00:00,,01/01/0001 00:00:00,01/01/0001 00:00:00,,0,,0,0,0,0,,0,0";
expected += Environment.NewLine;
string actual;
// Act
string actual;
using (var writer = new StringWriter())
{
WorkUnitRowCsvFileSerializer.Serialize(writer, value);
WorkUnitRowCsvFileSerializer.Serialize(writer, _value);
actual = writer.ToString();
}
// Assert
Assert.AreEqual(expected, actual);
Assert.AreEqual(_expected, actual);
}

[Test]
public void WorkUnitRowCsvFileSerializer_Serialize_UsingCzechCulture_Test()
{
// Arrange
Thread.CurrentThread.CurrentCulture = new CultureInfo("cs-CZ");
var value = new List<WorkUnitRow>();
value.Add(new WorkUnitRow());
string expected = "DatabaseID,ProjectID,ProjectRun,ProjectClone,ProjectGen,Name,Path,Username,Team,CoreVersion,FramesCompleted,FrameTime,Result,Assigned,Finished,WorkUnitName,KFactor,Core,Frames,Atoms,PreferredDays,MaximumDays,SlotType,PPD,Credit";
expected += Environment.NewLine;
expected += "0,0,0,0,0,,,,0,0,0,00:00:00,,01/01/0001 00:00:00,01/01/0001 00:00:00,,0,,0,0,0,0,,0,0";
expected += Environment.NewLine;
string actual;
// Act
string actual;
using (var writer = new StringWriter())
{
WorkUnitRowCsvFileSerializer.Serialize(writer, value);
WorkUnitRowCsvFileSerializer.Serialize(writer, _value);
actual = writer.ToString();
}
// Assert
Assert.AreEqual(expected, actual);
Assert.AreEqual(_expected, actual);
}
}
}

0 comments on commit 96be338

Please sign in to comment.