C#C
C#2y ago
Rowin ツ

Unit testing FakeItEasy

I'm currently working on a project and I want to implement Unit tests for certain cases.
After some research I decided to use FakeItEasy, but honestly I have NO clue what and how I am supposed to write out certain cases. The following example is some test I at least managed to write without having any errors and having succeeded after running the test. Though I should get a list of Dossiers back, I checked the result using Debugging and it should return a full list. Is there anyone that could briefly help me figure out how this "mocking" works and how I should write out this case?

public class DossierControllerTests
{
    [Fact]
    public void DossierController_GetAllDossiers_ReturnsFullList()
    {
        int id = 3;
        var repo =  A.Fake<IRepository<Dossier>>();

        var result = A.CallTo(() => repo.GetAllByIntId(id)).Returns(new List<Dossier>());
    }
}
image.png
Was this page helpful?