Пример #1
0
        public async Task Test_valida_sem_preenchimento_origem_destino_voo_iguais(string numeroVoo, string matriculaAeronave, string tipoAeronave, string origem, string destino)
        {
            planoVooModel = new PlanoVooModel(numeroVoo, matriculaAeronave, DateTime.Now, tipoAeronave, origem, destino);
            Exception ex = Assert.ThrowsAsync <Exception>(async() => await planoService.Criar(planoVooModel));

            Assert.IsTrue(ex.Message.Equals("A Origem e o Destino não podem ser iguais"));
        }
Пример #2
0
        public async Task Test_valida_sem_preenchimento_tipo_aeronave(string numeroVoo, string matriculaAeronave)
        {
            planoVooModel = new PlanoVooModel(numeroVoo, matriculaAeronave, DateTime.Now);
            Exception ex = Assert.ThrowsAsync <Exception>(async() => await planoService.Criar(planoVooModel));

            Assert.IsTrue(ex.Message.Equals("Preencha o Tipo da Aeronave"));
        }
Пример #3
0
        public async Task Test_valida_sem_preenchimento_destino_voo(string numeroVoo, string matriculaAeronave, string tipoAeronave, string origem)
        {
            planoVooModel = new PlanoVooModel(numeroVoo, matriculaAeronave, DateTime.Now, tipoAeronave, origem);
            Exception ex = Assert.ThrowsAsync <Exception>(async() => await planoService.Criar(planoVooModel));

            Assert.IsTrue(ex.Message.Equals("Preencha a Destino do Voo"));
        }
Пример #4
0
        public async Task Test_valida_sem_preenchimento_numero_voo()
        {
            planoVooModel = new PlanoVooModel();
            Exception ex = Assert.ThrowsAsync <Exception>(async() => await planoService.Criar(planoVooModel));

            Assert.IsTrue(ex.Message.Equals("Preencha o Número do Voo"));
        }
Пример #5
0
        public async Task Test_valida_sem_preenchimento_matricula_aeronave(string numeroVoo)
        {
            planoVooModel = new PlanoVooModel(numeroVoo);
            Exception ex = Assert.ThrowsAsync <Exception>(async() => await planoService.Criar(planoVooModel));

            Assert.IsTrue(ex.Message.Equals("Preencha a Matrícula da Aeronave"));
        }
Пример #6
0
        public void Setup()
        {
            this.planoVooModel = new PlanoVooModel();
            var planoRepository = new PlanoVooRepositoryMock();

            this.planoService = new PlanoVooService(planoRepository);
        }
Пример #7
0
        public async Task Test_valida_sem_preenchimento()
        {
            planoVooModel = null;
            Exception ex = Assert.ThrowsAsync <Exception>(async() => await planoService.Criar(planoVooModel));

            Assert.IsTrue(ex.Message.Equals("Preencha os campos para prosseguir"));
        }
Пример #8
0
        public async Task Test_valida_cadastro_plano_voo(string numeroVoo, string matriculaAeronave, string tipoAeronave, string origem, string destino)
        {
            planoVooModel = new PlanoVooModel(numeroVoo, matriculaAeronave, DateTime.Now, tipoAeronave, origem, destino);
            var resposta = await planoService.Criar(planoVooModel);

            Assert.AreEqual(3, resposta.Id);
        }
Пример #9
0
        public async Task Test_valida_preenchimento_numero_voo_existente(string numeroVoo, string matriculaAeronave, string tipoAeronave, string origem, string destino)
        {
            planoVooModel = new PlanoVooModel(numeroVoo, matriculaAeronave, DateTime.Now, tipoAeronave, origem, destino);
            Exception ex = Assert.ThrowsAsync <Exception>(async() => await planoService.Criar(planoVooModel));

            Assert.IsTrue(ex.Message.Equals("O Número do Voo que foi informado, já existe. Informe outro Número do Voo para continuar"));
        }
Пример #10
0
        public async Task Test_valida_preenchimento_destino(string numeroVoo, string matriculaAeronave, string tipoAeronave, string origem, string destino)
        {
            planoVooModel = new PlanoVooModel(numeroVoo, matriculaAeronave, DateTime.Now, tipoAeronave, origem, destino);
            Exception ex = Assert.ThrowsAsync <Exception>(async() => await planoService.Criar(planoVooModel));

            Assert.IsTrue(ex.Message.Equals("O Destino deve conter 7 caracteres"));
        }
Пример #11
0
        public async Task Test_valida_atualizar_item_inexistente(string numeroVoo, string matriculaAeronave, string tipoAeronave, string origem, string destino)
        {
            planoVooModel               = new PlanoVooModel(numeroVoo, matriculaAeronave, DateTime.Now, tipoAeronave, origem, destino);
            planoVooModel.Id            = 5;
            planoVooModel.DataAlteracao = null;
            Exception ex = Assert.ThrowsAsync <Exception>(async() => await planoService.Atualizar(planoVooModel));

            Assert.IsTrue(ex.Message.Equals("O Plano do Voo não existe"));
        }
Пример #12
0
        public async Task Test_valida_atualizar(string numeroVoo, string matriculaAeronave, string tipoAeronave, string origem, string destino)
        {
            planoVooModel               = new PlanoVooModel(numeroVoo, matriculaAeronave, DateTime.Now, tipoAeronave, origem, destino);
            planoVooModel.Id            = 1;
            planoVooModel.DataAlteracao = null;
            var resposta = await planoService.Atualizar(planoVooModel);

            Assert.IsTrue(planoVooModel.Id == resposta.Id && planoVooModel.DataAlteracao != resposta.DataAlteracao);
        }
Пример #13
0
 public async Task <PlanoVooModel> Update(PlanoVooModel model)
 {
     listMock.FirstOrDefault(x => x.Id == model.Id).DataAlteracao = DateTime.Now;
     return(listMock.FirstOrDefault(x => x.Id == model.Id));
 }
Пример #14
0
 public async Task <PlanoVooModel> Insert(PlanoVooModel model)
 {
     model.Id = listMock.Count + 1;
     listMock.Add(model);
     return(model);
 }