© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•6mo ago•
42 replies
AizakkuIV

✅ Codes runs as expected, but Unit Test keeps failing

This is the unit test that keeps the helper methods from evaluating to green

[Fact]
public void SaveAndLoadGame()
{
    var fileName   = "TestGomoku.csv";
    var field      = InitAGame();
    var fieldSaved = (int[,])field.Clone();

    Gomoku.SaveGame(field, fileName);

    var csvImport   = new CsvImport<SavedGame>();
    var csvExported = csvImport.Read(fileName);

    csvExported.Should().HaveCount(Gomoku.GetStoneCount(field));

    field.Should().BeEquivalentTo(fieldSaved, "save must not change field");
    Gomoku.LoadGame(15, fileName).Should().BeEquivalentTo(field);
}
[Fact]
public void SaveAndLoadGame()
{
    var fileName   = "TestGomoku.csv";
    var field      = InitAGame();
    var fieldSaved = (int[,])field.Clone();

    Gomoku.SaveGame(field, fileName);

    var csvImport   = new CsvImport<SavedGame>();
    var csvExported = csvImport.Read(fileName);

    csvExported.Should().HaveCount(Gomoku.GetStoneCount(field));

    field.Should().BeEquivalentTo(fieldSaved, "save must not change field");
    Gomoku.LoadGame(15, fileName).Should().BeEquivalentTo(field);
}


And this is the only error message provided
image.png
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Test createAsync not working as expected
C#CC# / help
2y ago
Unit test help
C#CC# / help
17mo ago
Unit test error
C#CC# / help
2y ago
Unit Test not working.
C#CC# / help
4y ago