I'm trying to test file upload service by pathing IFormFile
object but it throws exception when pathing moqed file to target service.
[Fact]
public async Task ReadSheetFile_Test()
{
var fileMock = new Mock<IFormFile>();
fileMock.Setup(x => x.FileName).Returns("file1.xlsx");
var result = _voucherAppService.ReadSheetFile(fileMock.Object);
result.Count().ShouldBe(0);
}
Exception
Property accessor 'Location' on object System.Reflection.Emit.InternalAssemblyBuilder threw the following exception:'The invoked member is not supported in a dynamic assembly.