Example #1
0
 public GerenciadorMateria(MateriaService serviceMateria, SerieService serviceSerie, DisciplinaService serviceDisciplina)
 {
     _serviceSerie      = serviceSerie;
     _serviceDisciplina = serviceDisciplina;
     _serviceMateria    = serviceMateria;
     CarregarListagem();
 }
Example #2
0
        public Serie Get(int requestId)
        {
            var service = new SerieService(DataContext);
            var serie   = service.GetById(requestId);

            return(serie);
        }
Example #3
0
        public List <Serie> GetAllSeries()
        {
            var service = new SerieService(DataContext);
            var series  = service.GetAllSeries();

            return(series);
        }
Example #4
0
        public string Update([FromBody] Serie SerieRequest)
        {
            var service = new SerieService(DataContext);

            service.Update(SerieRequest);
            return("El recurso se modifico correctamente");
        }
Example #5
0
        public string Create([FromBody] Serie SerieRequest)
        {
            var service = new SerieService(DataContext);

            service.Create(SerieRequest);
            return("El recurso se creĆ³ correctamente");
        }
Example #6
0
 public AtorController(AtorService atorService, FilmeService filmeService, SerieService serieService)
 {
     _serieService    = serieService;
     _filmeService    = filmeService;
     this.atorService = atorService;
     _atorService     = atorService;
 }
Example #7
0
        public string Delete(int id)
        {
            var service = new SerieService(DataContext);

            service.Delete(id);

            return("El recurso se elimino correctamente");
        }
Example #8
0
        public void cargarComboSerie(ComboBox combo, int fabricante)
        {
            SerieService service = new SerieService();

            combo.DataSource    = service.getSeries(fabricante);
            combo.DisplayMember = "Nombre";
            combo.ValueMember   = "IdSerie";
            combo.SelectedIndex = -1;
        }
Example #9
0
 public GerenciadorProva(ProvaService serviceProva, DisciplinaService serviceDisciplina, MateriaService serviceMateria,
                         SerieService serviceSerie, QuestaoService serviceQuestao)
 {
     _serviceProva      = serviceProva;
     _serviceDisciplina = serviceDisciplina;
     _serviceMateria    = serviceMateria;
     _serviceQuestao    = serviceQuestao;
     _serviceSerie      = serviceSerie;
     CarregarListagem();
 }
Example #10
0
        public FormMateria(MateriaService service, DisciplinaService serviceDisciplina, SerieService serviceSerie)
        {
            _service           = service;
            _serviceDisciplina = serviceDisciplina;
            _serviceSerie      = serviceSerie;

            InitializeComponent();
            PopulateComboBoxSerie();
            PopulateComboBoxDisciplina();
        }
Example #11
0
        public static void Iniciar()
        {
            serieService = new SerieService(new SerieRepositorio());

            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("\t#### Bem vindo a DIO Series ####\n");
            bool chaveMenu = true;

            while (chaveMenu)
            {
                Roteador(ApresentaOpcoesMenu(), out chaveMenu);
            }
        }
Example #12
0
        public IActionResult PutActivarSerie(int id)
        {
            var          res    = new Dictionary <string, Object>();
            SerieService serSrv = new SerieService();

            try
            {
                serSrv.ActivarSerie(id);
                return(Ok());
            }
            catch (Exception e)
            {
                return(BadRequest(new { Message = "Error en el servidor" }));
            }
        }
Example #13
0
        public async Task ThrowArgumentNullException_WhenPassedNullAccessToken()
        {
            // Arrange
            Mock <IPandaScoreClient> pandaScoreClientMock = new Mock <IPandaScoreClient>();
            Mock <DataContext>       dataContextMock      = new Mock <DataContext>();

            // Act
            SerieService SUT = new SerieService(
                pandaScoreClientMock.Object,
                dataContextMock.Object);

            // Assert
            await Assert.ThrowsExceptionAsync <ArgumentNullException>(async() =>
                                                                      await SUT.RebaseSeriesAsync(null));
        }
Example #14
0
        public async Task ThrowArgumentException_WhenPassedInvalidId(string invalidId)
        {
            // Arrange
            Mock <IPandaScoreClient> pandaScoreClientMock = new Mock <IPandaScoreClient>();
            Mock <DataContext>       dataContextMock      = new Mock <DataContext>();

            // Act
            SerieService SUT = new SerieService(
                pandaScoreClientMock.Object,
                dataContextMock.Object);

            // Assert
            await Assert.ThrowsExceptionAsync <ArgumentException>(async() =>
                                                                  await SUT.FindAsync(invalidId));
        }
        public async Task FilterSeriesAsync_ShouldReturnSeries_WhenPassedValidParameters()
        {
            // Arrange
            var contextOptions = new DbContextOptionsBuilder <DataContext>()
                                 .UseInMemoryDatabase(databaseName: "FilterSeriesAsync_ShouldReturnSeries_WhenPassedValidParameters")
                                 .Options;

            string validSortOrder  = "name_asc";
            string validFilter     = "testSerie";
            int    validPageSize   = 10;
            int    validPageNumber = 1;
            string season          = "2050";
            string validName       = "testSerie";

            Serie validSerie = new Serie
            {
                Name   = validName,
                Season = season
            };

            IEnumerable <Serie> result = new List <Serie>();

            // Act
            using (DataContext actContext = new DataContext(contextOptions))
            {
                Mock <IPandaScoreClient> pandaScoreClientMock = new Mock <IPandaScoreClient>();

                await actContext.Series.AddAsync(validSerie);

                await actContext.SaveChangesAsync();

                SerieService SUT = new SerieService(
                    pandaScoreClientMock.Object,
                    actContext);

                result = await SUT.FilterSeriesAsync(validSortOrder, validFilter, validPageNumber, validPageSize);
            }

            // Assert
            using (DataContext assertContext = new DataContext(contextOptions))
            {
                var serie = result.ToArray()[0];

                Assert.IsTrue(assertContext.Series.Count().Equals(result.Count()));
                Assert.IsTrue(assertContext.Series.Any(s => s.Name.Equals(serie.Name)));
                Assert.IsTrue(assertContext.Series.Any(s => s.Season.Equals(serie.Season)));
            }
        }
Example #16
0
        public IActionResult Delete(int id)
        {
            var          res    = new Dictionary <string, Object>();
            SerieService serSrv = new SerieService();

            try
            {
                serSrv.deleteSerie(id);
                return(Ok());
            }
            catch (Exception e)
            {
                res.Add("message", "Error en el servidor");
                return(BadRequest(res));
            }
        }
        public async Task RebaseSeriesAsync_ShouldRepopulateSpellSerie_WhenPassedValidParameters()
        {
            // Arrange
            var contextOptions = new DbContextOptionsBuilder <DataContext>()
                                 .UseInMemoryDatabase(databaseName: "RebaseSeriesAsync_ShouldRepopulateSerieTable_WhenPassedValidParameters")
                                 .Options;

            string validAccessToken    = string.Empty;
            string validCollectionName = "series";
            int    validPageSize       = 100;

            Serie validSerie = new Serie
            {
                Id        = Guid.NewGuid(),
                Name      = "testSerie",
                DeletedOn = DateTime.UtcNow.AddHours(2),
                IsDeleted = true
            };

            IEnumerable <Serie> validSerieList = new List <Serie>()
            {
                validSerie
            };

            // Act
            using (DataContext actContext = new DataContext(contextOptions))
            {
                Mock <IPandaScoreClient> pandaScoreClientMock = new Mock <IPandaScoreClient>();

                pandaScoreClientMock
                .Setup(mock => mock.GetEntitiesParallel <Serie>(validAccessToken, validCollectionName, validPageSize))
                .Returns(Task.FromResult(validSerieList));

                SerieService SUT = new SerieService(
                    pandaScoreClientMock.Object,
                    actContext);

                await SUT.RebaseSeriesAsync(validAccessToken);
            }

            // Assert
            using (DataContext assertContext = new DataContext(contextOptions))
            {
                Assert.IsTrue(assertContext.Series.Count() == 1);
                Assert.IsTrue(assertContext.Series.Contains(validSerie));
            }
        }
Example #18
0
        public IActionResult Post(Serie serie)
        {
            SerieService serieSer = new SerieService();
            var          res      = new Dictionary <string, Object>();

            try
            {
                serie = serieSer.insertSerie(serie);
                res.Add("serie", serie);
                return(Ok(res));
            }
            catch (Exception e)
            {
                res.Add("message", "No fue posible guardar la serie");
                return(BadRequest(res));
            }
        }
Example #19
0
        public IActionResult Put(int id, Serie serie)
        {
            var          res    = new Dictionary <string, Object>();
            SerieService serSrv = new SerieService();

            try
            {
                serSrv.updateSerie(serie);
                res.Add("serie", serie);
                return(Ok(serie));
            }
            catch (Exception e)
            {
                res.Add("message", "Error en el servidor");
                return(BadRequest(res));
            }
        }
Example #20
0
        public FacturamaApi(string user, string password, bool isDevelopment = true)
        {
            var url = isDevelopment ? "https://apisandbox.facturama.mx/" : "https://api.facturama.mx/";

            var httpClient = new RestClient(url)
            {
                Authenticator = new HttpBasicAuthenticator(user, password)
            };

            Clients       = new ClientService(httpClient);
            Cfdis         = new CfdiService(httpClient);
            Products      = new ProductService(httpClient);
            BranchOffices = new BranchOfficeService(httpClient);
            Profile       = new ProfileService(httpClient);
            TaxEntities   = new TaxEntityService(httpClient);
            Series        = new SerieService(httpClient);
            Catalogs      = new CatalogService(httpClient);
        }
        public async Task ThrowArgumentOutOfRangeException_WhenPassedInvalidPageSize(int invalidPageSize)
        {
            // Arrange
            Mock <IPandaScoreClient> pandaScoreClientMock = new Mock <IPandaScoreClient>();
            Mock <DataContext>       dataContextMock      = new Mock <DataContext>();

            string validSortOrder  = string.Empty;
            string validFilter     = string.Empty;
            int    validPageNumber = 1;

            SerieService SUT = new SerieService(
                pandaScoreClientMock.Object,
                dataContextMock.Object);

            // Act & Assert
            await Assert.ThrowsExceptionAsync <ArgumentOutOfRangeException>(
                () => SUT.FilterSeriesAsync(validSortOrder, validFilter, validPageNumber, invalidPageSize));
        }
Example #22
0
        public FacturamaApi(string user, string password, string url)
        {
            var httpClient = new RestClient(url)
            {
                Authenticator = new HttpBasicAuthenticator(user, password)
            };

            Clients       = new ClientService(httpClient);
            Cfdis         = new CfdiService(httpClient);
            Products      = new ProductService(httpClient);
            BranchOffices = new BranchOfficeService(httpClient);
            Profile       = new ProfileService(httpClient);
            TaxEntities   = new TaxEntityService(httpClient);
            Series        = new SerieService(httpClient);
            Catalogs      = new CatalogService(httpClient);
            Store         = new StoreService(httpClient);
            Charges       = new ChargeService(httpClient);
        }
        public async Task FindAsync_ShouldReturnSerie_WhenPassedValidParameters()
        {
            // Arrange
            var contextOptions = new DbContextOptionsBuilder <DataContext>()
                                 .UseInMemoryDatabase(databaseName: "FindAsync_ShouldReturnSerie_WhenPassedValidParameters")
                                 .Options;

            Guid validId = Guid.NewGuid();

            Serie validPlayer = new Serie
            {
                Id     = validId,
                Name   = "testChamp",
                Slug   = "testSlug",
                Season = "testSeason"
            };

            Serie result = null;

            // Act
            using (DataContext actContext = new DataContext(contextOptions))
            {
                Mock <IPandaScoreClient> pandaScoreClientMock = new Mock <IPandaScoreClient>();

                await actContext.Series.AddAsync(validPlayer);

                await actContext.SaveChangesAsync();

                SerieService SUT = new SerieService(
                    pandaScoreClientMock.Object,
                    actContext);

                result = await SUT.FindAsync(validId.ToString());
            }

            // Assert
            using (DataContext assertContext = new DataContext(contextOptions))
            {
                Assert.IsTrue(assertContext.Series.Any(c => c.Id.Equals(result.Id)));
                Assert.IsTrue(assertContext.Series.Any(c => c.Name.Equals(result.Name)));
                Assert.IsTrue(assertContext.Series.Any(c => c.Slug.Equals(result.Slug)));
                Assert.IsTrue(assertContext.Series.Any(c => c.Season.Equals(result.Season)));
            }
        }
Example #24
0
 public FormProva(ProvaService serviceProva, DisciplinaService serviceDisciplina, MateriaService serviceMateria,
                  SerieService serviceSerie, QuestaoService serviceQuestao)
 {
     _serviceProva      = serviceProva;
     _serviceDisciplina = serviceDisciplina;
     _serviceMateria    = serviceMateria;
     _serviceQuestao    = serviceQuestao;
     _serviceSerie      = serviceSerie;
     InitializeComponent();
     _materia = _serviceMateria.PegarTodos();
     _questao = _serviceQuestao.PegarTodos();
     PopulateComboBoxSerie();
     PopulateComboBoxDisciplina();
     // PopulateComboBoxMateria();
     if (_prova == null)
     {
         _prova = new Prova();
     }
 }
Example #25
0
        public IActionResult Get(int pagina, int rpp)
        {
            var          result   = new Dictionary <string, Object>();
            SerieService serieSer = new SerieService();

            try
            {
                result = serieSer.getSeries(pagina, rpp);
                return(Ok(result));
            } catch (Exception e)
            {
                if (e is NotFoundException)
                {
                    result.Add("message", e.Message);
                    return(BadRequest(result));
                }
                result.Add("message", "Error en el servidor");
                return(StatusCode(500, result));
            }
        }
Example #26
0
        public IActionResult Get(int id)
        {
            var          res    = new Dictionary <string, Object>();
            SerieService serSrv = new SerieService();

            try
            {
                Serie serie = new Serie();
                serie = serSrv.getSerie(id);
                res.Add("serie", serie);
                return(Ok(res));
            }
            catch (Exception e)
            {
                if (e is NotFoundException)
                {
                    res.Add("message", e.Message);
                    return(NotFound(res));
                }
                res.Add("message", "Error en el servidor");
                return(StatusCode(500, res));
            }
        }
 public FormCadastroSerie(SerieService servico) : base()
 {
     InitializeComponent();
     _servico = servico;
 }
Example #28
0
 public FormSerie(SerieService service)
 {
     _service = service;
     InitializeComponent();
     btnSalvar.Enabled = false;
 }
        public FormCadastroTeste(TesteService servico, DisciplinaService disciplinaService, MateriaService materiaService, SerieService serieService) : base()
        {
            InitializeComponent();
            if (_entidade == null)
            {
                _entidade = new Teste();
            }

            _servico = servico;

            _listaDisciplinas = disciplinaService.BuscarTodos();
            _listaMaterias    = materiaService.BuscarTodos();
            _listaSerie       = serieService.BuscarTodos();

            PopularComboBoxs(_listaDisciplinas, _listaMaterias, _listaSerie);
        }
        public FormCadastroMateria(MateriaService servico, DisciplinaService disciplinaService, SerieService serieService) : base()
        {
            InitializeComponent();
            if (_entidade == null)
            {
                _entidade = new Materia();
            }
            _servico = servico;

            PopularComboBoxs(disciplinaService.BuscarTodos(), serieService.BuscarTodos());
        }