public FilmsController()
        {
            string connectionString =
                "server=localhost;port=3306;database=sakila;userid=DataAccess;pwd=Da.2019.IEGP;sslmode=none";

            dbContext = SakilaDbContextFactory.Create(connectionString);
        }
示例#2
0
        public ActorsController()
        {
            // string connectionString = "server=localhost;port=3306;database=sakila;userid=admin;pwd=arnoboy11;sslmode=none";
            string connectionString = "server=192.168.100.13;port=3306;database=sakila;userid=admin;pwd=arnoboy11";

            dbContext = SakilaDbContextFactory.Create(connectionString);
        }
示例#3
0
        public FilmsController()
        {
            string connectionString =
                "server=localhost;port=3306;database=sakila;userid=root;pwd=123456";

            dbContext = SakilaDbContextFactory.Create(connectionString);
        }
        private ICityService getCityService()
        {
            DbContextOptions options     = MySqlDbContextOptionsExtensions.UseMySql(new DbContextOptionsBuilder(), ConnectionString).Options;
            SakilaDbContext  ctx         = new SakilaDbContext(options);
            ICityService     cityService = new CityService(ctx);

            return(cityService);
        }
示例#5
0
        public void testFindById()
        {
            DbContextOptions options     = MySqlDbContextOptionsExtensions.UseMySql(new DbContextOptionsBuilder(), ConnectionString).Options;
            SakilaDbContext  ctx         = new SakilaDbContext(options);
            IFilmService     filmService = new FilmService(ctx);

            Film film = filmService.findById(83);

            Assert.Equal("BLUES INSTINCT", film.Title);
        }
示例#6
0
        public void testListAll()
        {
            DbContextOptions options     = MySqlDbContextOptionsExtensions.UseMySql(new DbContextOptionsBuilder(), ConnectionString).Options;
            SakilaDbContext  ctx         = new SakilaDbContext(options);
            IFilmService     filmService = new FilmService(ctx);

            List <Film> filmsList = filmService.listAll();

            Assert.Equal(1000, filmsList.Count);
        }
示例#7
0
        public void testListAll()
        {
            // restauração do banco
            DbContextOptions options = MySqlDbContextOptionsExtensions
                                       .UseMySql(new DbContextOptionsBuilder(), "server=172.16.99.230;userid=root;pwd=1q2w3e4r;port=3308;database=sakila;sslmode=none;").Options;

            SakilaDbContext ctx = new SakilaDbContext(options);

            filmService = new FilmService(ctx);
            var list = filmService.listAll();

            Assert.Equal(1000, list.Count);
            Assert.NotNull(list[45].Language);
        }
示例#8
0
        public void testSaveOrUpdate_atualizacao()
        {
            DbContextOptions options     = MySqlDbContextOptionsExtensions.UseMySql(new DbContextOptionsBuilder(), ConnectionString).Options;
            SakilaDbContext  ctx         = new SakilaDbContext(options);
            IFilmService     filmService = new FilmService(ctx);

            Film film = new Film()
            {
                Id          = 2,
                Title       = "Filme Teste2",
                Description = "Description2",
                ReleaseYear = 2019
            };

            filmService.saveOrUpdate(film);
            Assert.Equal("Filme Teste2", filmService.findById(2).Title);
        }
示例#9
0
        public void testSaveOrUpdate_insercao()
        {
            DbContextOptions options     = MySqlDbContextOptionsExtensions.UseMySql(new DbContextOptionsBuilder(), ConnectionString).Options;
            SakilaDbContext  ctx         = new SakilaDbContext(options);
            IFilmService     filmService = new FilmService(ctx);

            Film film = new Film()
            {
                Title       = "Filme Teste",
                Description = "Description",
                ReleaseYear = 2018
            };

            filmService.saveOrUpdate(film);

            Assert.Equal(film, filmService.findById(1001));
            Assert.Equal(1001, filmService.listAll().Count);
        }
示例#10
0
        public ActorsController()
        {
            string connectionString = "server=localhost;port=3306;database=sakila;userid=root;pwd=ks7r2400;sslmode=none";

            dbContext = SakilaDbContextFactory.Create(connectionString);
        }
示例#11
0
 public FilmActorsController(SakilaDbContext context)
 {
     _context = context;
 }
 public InventoriesController(SakilaDbContext context)
 {
     _context = context;
 }
示例#13
0
 public FilmService(SakilaDbContext dbContext)
 {
     this.dbContext = dbContext;
 }
示例#14
0
 public ActorsController(SakilaDbContext dbContext)
 {
     dataBaseContext = dbContext;
 }
 public RentalsController(SakilaDbContext context)
 {
     _context = context;
 }
示例#16
0
 public CityService(SakilaDbContext ctx)
 {
     this.ctx = ctx;
 }
示例#17
0
 public CustomerService(SakilaDbContext ctx)
 {
     this.ctx = ctx;
 }
示例#18
0
 public FilmService(SakilaDbContext ctx)
 {
     this.ctx = ctx;
 }
 public CustomersController(SakilaDbContext context)
 {
     _context = context;
 }
示例#20
0
 public LanguageService(SakilaDbContext context)
 {
     this.context = context;
 }
示例#21
0
        public AtorController()
        {
            string connectionString = "server=localhost;port=3306;database=sakila_tiagopassos;userid=root;pwd=;sslmode=none";

            dbContext = SakilaDbContextFactory.Create(connectionString);
        }