public void TestePacoteBuscarPorIdExiste() { var options = new DbContextOptionsBuilder <CodeTurContext>() .UseInMemoryDatabase(databaseName: "PacoteCadastrar") .Options; PacoteDominio pacote = new PacoteDominio() { Titulo = "Pacote 5 Empresas Canada", Imagem = "https://www.albait-alcanadi.com/wp-content/uploads/2016/05/canada-business-immigration-programs-al-bait-al-canadi-for-immigration-services-600x330.jpg", Pais = "Canada", Ativo = true, DataInicio = DateTime.Now.AddDays(-20), DataFim = DateTime.Now.AddDays(-13), Descricao = "Conheça diversas empresas no Canada" }; // Use a clean instance of the context to run the test using (var context = new CodeTurContext(options)) { var service = new PacoteRepositorio(context); service.Cadastrar(pacote); var result = service.BuscarPorId(1); Assert.NotNull(result); Assert.Equal(1, result.Id); } }