public void Get_BuscaTodosOsFuncionarios_True() { var options = new DbContextOptionsBuilder <ContextEmpresa>() .UseInMemoryDatabase(databaseName: "Get_funcionarios") .Options; // Insert seed data into the database using one instance of the context using (var context = new ContextEmpresa(options)) { context.Funcionarios.Add(new Funcionario { Cpf = 111111111, Nome = "Funcionario 1" }); context.Funcionarios.Add(new Funcionario { Cpf = 222222222, Nome = "Funcionario 2" }); context.Funcionarios.Add(new Funcionario { Cpf = 333333333, Nome = "Funcionario 3" }); context.SaveChanges(); } // Use a clean instance of the context to run the test using (var context = new ContextEmpresa(options)) { var service = new RepositoryFuncionario(context); var result = service.Get(); //Assert.AreEqual(3, result.Count()); } }
public IQueryable <Funcionario> Get() { return(_funcionarioRepositorio.Get()); }