vendredi 18 septembre 2020

How to mock a FileProvider in C#?

I have a unit test that looks like this :

public class MyFileProviderTest {
  private readonly MyFileProvider subject;
  private readonly Mock<IFileProvider> fileprovider = new Mock<IFileProvider>;

  public MyFileProviderTest {
    subject = new MyFileProvider(fileprovider.Object)
  }

  [Fact]
  public void GetAssets(){
     fileprovider.Setup(x => x.GetDirectoryContents(It.IsAny<string>())).Returns(new ?????);
  }
}

What should ????? be ?. I cannot find a proper example in Microsoft documentation.

Aucun commentaire:

Enregistrer un commentaire