Exemple #1
0
        public void TEST_MOCK_REPOSITORY()
        {
            var options = new DbContextOptionsBuilder <EFApplicationContext>()
                          .UseInMemoryDatabase("portal_xpto")
                          .Options;

            using (var context = new EFApplicationContext(options))
            {
                context.XptoSet.Add(new Xpto {
                    Id = Guid.NewGuid()
                });
                context.XptoSet.Add(new Xpto {
                    Id = Guid.NewGuid()
                });
                context.SaveChanges();
            }

            using (var context = new EFApplicationContext(options))
            {
                var service = new XptoRepository(context);
                var result  = service.GetAll().ToList();
                Assert.NotNull(result);
            }
        }
 public QueryVolumes(IConfiguration config, XptoRepository repository)
 {
     this.config     = config;
     this.repository = repository;
 }