Example #1
0
        public void Initialize()
        {
            //Arrange
            var builder = new DbContextOptionsBuilder <SosCidadaoContext>();

            builder.UseInMemoryDatabase("SosCidadaoContext");
            var options = builder.Options;

            _context = new SosCidadaoContext(options);
            _context.Database.EnsureDeleted();
            _context.Database.EnsureCreated();
            var autores = new List <Comentario>
            {
                new Comentario {
                    IdOcorrencia = 1, Descricao = "Carro havia uma porta amassada", DataCadastro = DateTime.Parse("2021-12-31")
                },
                new Comentario {
                    IdOcorrencia = 1, Descricao = "FOi visto pela Ășltima vez do posto Santo Bello.", DataCadastro = DateTime.Parse("2021-01-25")
                },
            };

            _context.AddRange(autores);
            _context.SaveChanges();

            _comentarioService = new ComentarioService(_context);
        }
Example #2
0
        public void Initialize()
        {
            //Arrange
            var builder = new DbContextOptionsBuilder <SosCidadaoContext>();

            builder.UseInMemoryDatabase("SosCidadaoContext");
            var options = builder.Options;

            _context = new SosCidadaoContext(options);
            _context.Database.EnsureDeleted();
            _context.Database.EnsureCreated();
            var tiposPertences = new List <Tipopertence>
            {
                new Tipopertence {
                    Nome = "Moto", IdOrganizacao = 1,
                },
                new Tipopertence {
                    Nome = "Carro", IdOrganizacao = 1,
                },
            };

            _context.AddRange(tiposPertences);
            _context.SaveChanges();

            _tipoPertenceService = new TipopertenceService(_context);
        }
Example #3
0
 public OrganizacaoService(SosCidadaoContext context)
 {
     _context = context;
 }
Example #4
0
 public PessoaService(SosCidadaoContext context)
 {
     _context = context;
 }
Example #5
0
 public ComentarioService(SosCidadaoContext context)
 {
     _context = context;
 }
Example #6
0
 public TipoocorrenciaService(SosCidadaoContext context)
 {
     _context = context;
 }
Example #7
0
 public TipopertenceService(SosCidadaoContext context)
 {
     _context = context;
 }
Example #8
0
 public LocalService(SosCidadaoContext context)
 {
     _context = context;
 }