コード例 #1
0
        public void TarefaController_TesteBancoInMemory()
        {
            //Arrange
            var options = new DbContextOptionsBuilder <TarefaContext>()
                          .UseInMemoryDatabase(databaseName: "TarefaIntegrationTestDatabase")
                          .Options;

            var tarefa = new Tarefa()
            {
                Chave        = 7,
                Nome         = "Apresentar teste de integração no Dojo",
                EstaCompleta = false
            };

            TarefaRepository repository = null;

            //Act
            using (var context = new TarefaContext(options))
            {
                repository = new TarefaRepository(context);
                repository.Add(tarefa);
            }

            //Assert
            repository.Should().NotBeNull();
        }