using GeradoresService; using GeradoresService.DAL; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; namespace UnitTest { public class DB { private readonly GeradoresContext _context; public DB() { var configuration = new ConfigurationBuilder() .AddJsonFile("appsettings.json") .Build(); // Obter a connection string a partir do arquivo de configuração var connectionString = configuration.GetConnectionString("GeradoresConnection"); // Configurar o DbContext para usar o InMemoryDatabase var options = new DbContextOptionsBuilder() .UseSqlServer(connectionString) .Options; _context = new GeradoresContext(options); } [Fact] public void GenerateNIF() { var nif = new NIF(_context); //var gerenatednif = nif.Generate("2"); //Assert.NotEmpty(gerenatednif); } } }