Beispiel #1
0
        public void GetAcessoAluno_AlunoMedMasterCancelado_MedsoftProElectron_PermiteAcesso()
        {
            if (Utilidades.AntesDataLiberacaoTestesMedMaster())
            {
                Assert.Inconclusive("Não há cenarios Medmaster");
            }

            var aluno    = new PerfilAlunoEntityTestData().GetAlunoMedMasterAnoAtualCancelado();
            var clientes = new ClienteEntity().GetByFilters(new Cliente {
                Register = aluno.Register
            }, aplicacao: Aplicacoes.MEDSOFT_PRO_ELECTRON);

            var idDevice = (int)Utilidades.TipoDevice.androidMobile;

            var configMock = Substitute.For <IConfigData>();
            var versaoMock = Substitute.For <IVersaoAppPermissaoEntityData>();
            var clientMock = Substitute.For <IClienteEntity>();

            configMock.GetDeveBloquearAppVersaoNula().Returns(false);
            configMock.GetTempoInadimplenciaTimeoutParametro().Returns(24);
            clientMock.UserGolden(Arg.Any <string>(), Arg.Any <Aplicacoes>()).Returns(1);
            clientMock.GetByFilters(Arg.Any <Cliente>(), Arg.Any <int>(), Arg.Any <Aplicacoes>()).Returns(clientes);

            var business = new AlunoBusiness(new AlunoEntity(), clientMock, configMock, versaoMock);

            var alunoRetorno = business.GetAcessoAluno(aluno.Register, "", (int)Aplicacoes.MEDSOFT_PRO_ELECTRON, null, "", idDevice);

            Assert.IsTrue(alunoRetorno.PermiteAcesso);
        }
Beispiel #2
0
        public void GetAcessoAluno_AlunoNaoMedMasterPendente_MedsoftProElectron_NaoPermiteAcesso()
        {
            var aluno = new PerfilAlunoEntityTestData().GetAlunoSomenteUmaOV(DateTime.Now.Year, (int)Produto.Produtos.MED, (int)OrdemVenda.StatusOv.Pendente, (int)OrdemVenda.StatusOv.Pendente, true);

            if (aluno == null)
            {
                Assert.Inconclusive("Não possui aluno nesse cenário");
            }

            var clientes = new ClienteEntity().GetByFilters(new Cliente {
                Register = aluno.Register
            }, aplicacao: Aplicacoes.MEDSOFT_PRO_ELECTRON);

            var idDevice = (int)Utilidades.TipoDevice.androidMobile;

            var configMock = Substitute.For <IConfigData>();
            var versaoMock = Substitute.For <IVersaoAppPermissaoEntityData>();
            var clientMock = Substitute.For <IClienteEntity>();

            configMock.GetDeveBloquearAppVersaoNula().Returns(false);
            configMock.GetTempoInadimplenciaTimeoutParametro().Returns(24);
            clientMock.UserGolden(Arg.Any <string>(), Arg.Any <Aplicacoes>()).Returns(1);
            clientMock.GetByFilters(Arg.Any <Cliente>(), Arg.Any <int>(), Arg.Any <Aplicacoes>()).Returns(clientes);

            var business = new AlunoBusiness(new AlunoEntity(), clientMock, configMock, versaoMock);

            var alunoRetorno = business.GetAcessoAluno(aluno.Register, "", (int)Aplicacoes.MEDSOFT_PRO_ELECTRON, null, "", idDevice);

            Assert.IsFalse(alunoRetorno.PermiteAcesso);
        }
Beispiel #3
0
        public void GetAcessoAluno_AlunoR4MastologiaAtivo_NaoExibeMensagensInadimplencia()
        {
            var aluno = new PerfilAlunoEntityTestData().GetAlunoSomenteUmaOV(DateTime.Now.Year, (int)Produto.Produtos.MASTO, (int)OrdemVenda.StatusOv.Ativa, (int)OrdemVenda.StatusOv.Adimplente);

            if (aluno == null)
            {
                Assert.Inconclusive("Não foi encontrado aluno no cenário");
            }

            var clientes = new ClienteEntity().GetByFilters(new Cliente {
                Register = aluno.Register
            }, aplicacao: Aplicacoes.MsProMobile);

            var idDevice = (int)Utilidades.TipoDevice.androidMobile;

            var configMock = Substitute.For <IConfigData>();
            var versaoMock = Substitute.For <IVersaoAppPermissaoEntityData>();
            var clientMock = Substitute.For <IClienteEntity>();

            configMock.GetDeveBloquearAppVersaoNula().Returns(false);
            configMock.GetTempoInadimplenciaTimeoutParametro().Returns(24);
            clientMock.UserGolden(Arg.Any <string>(), Arg.Any <Aplicacoes>()).Returns(1);
            clientMock.GetByFilters(Arg.Any <Cliente>(), Arg.Any <int>(), Arg.Any <Aplicacoes>()).Returns(clientes);

            var business = new AlunoBusiness(new AlunoEntity(), clientMock, configMock, versaoMock);

            var alunoRetorno = business.GetAcessoAluno(aluno.Register, "", (int)Aplicacoes.MsProMobile, null, "", idDevice);

            Assert.IsFalse(alunoRetorno.LstOrdemVendaMsg.Any(x => !string.IsNullOrEmpty(x.Mensagem)));
        }
Beispiel #4
0
        public void GetAcessoAluno_PerfilExtensivoAnoAtualInadimplenteBloqueado_RetornaAlunoComSucesso()
        {
            var alunos = new PerfilAlunoEntityTestData().GetAlunosExtensivoAnoAtualInadimplenteMesesAnterioresBloqueado().ToList();

            if (alunos.Count() == 0)
            {
                Assert.Inconclusive("Não foi possível encontrar aluno no cenário");
            }

            var aluno = alunos.FirstOrDefault();

            string appVersion = null;

            var configMock = Substitute.For <IConfigData>();
            var versaoMock = Substitute.For <IVersaoAppPermissaoEntityData>();

            configMock.GetDeveBloquearAppVersaoNula().Returns(false);
            configMock.GetTempoInadimplenciaTimeoutParametro().Returns(24);

            var business = new AlunoBusiness(new AlunoEntity(), new ClienteEntity(), configMock, versaoMock);

            var alunoRetorno = business.GetAcessoAluno(aluno.Register, (int)Aplicacoes.MsProMobile, appVersion);

            Assert.IsTrue(alunoRetorno.Sucesso);
        }
Beispiel #5
0
        public void GetAcessoAluno_PerfilAnoSeguinte_PermiteAcesso()
        {
            if (DateTime.Now.Month < 12)
            {
                Assert.Inconclusive("Fora da data relevante");
            }

            var aluno = new PerfilAlunoEntityTestData().GetAlunoExtensivoAnoSeguinte();

            if (aluno == null)
            {
                Assert.Inconclusive("Não há aluno no perfil");
            }

            var    deviceToken = Guid.NewGuid().ToString();
            var    idDevice    = (int)Utilidades.TipoDevice.androidMobile;
            string appVersion  = null;

            var configMock = Substitute.For <IConfigData>();
            var versaoMock = Substitute.For <IVersaoAppPermissaoEntityData>();

            configMock.GetDeveBloquearAppVersaoNula().Returns(false);
            configMock.GetTempoInadimplenciaTimeoutParametro().Returns(24);

            var business = new AlunoBusiness(new AlunoEntity(), new ClienteEntity(), configMock, versaoMock);

            var alunoRetorno = business.GetAcessoAluno(aluno.Register, aluno.Senha, (int)Aplicacoes.MsProMobile, appVersion, deviceToken, idDevice);

            Assert.IsTrue(alunoRetorno.PermiteAcesso);
        }
Beispiel #6
0
        public void GetAcessoAlunoUltimaVersaoIonic1_AlunoSenhaCorretaVersaoBloqueada_ErroVersaoBloqueada()
        {
            var clientesMockData = new Clientes {
                new PerfilAlunoEntityTestData().GetAlunoAcademicoMock()
            };

            var    register    = Constants.CpfClientTesteSemAcessoGolden;
            var    senha       = clientesMockData.First().Senha;
            var    deviceToken = Guid.NewGuid().ToString();
            var    idDevice    = (int)Utilidades.TipoDevice.androidMobile;
            string appVersion  = Utilidades.UltimaVersaoIonic1;

            var configMock = Substitute.For <IConfigData>();
            var versaoMock = Substitute.For <IVersaoAppPermissaoEntityData>();
            var clientMock = Substitute.For <IClienteEntity>();

            configMock.GetDeveBloquearAppVersaoNula().Returns(false);
            configMock.GetTempoInadimplenciaTimeoutParametro().Returns(100);

            clientMock.UserGolden(register, Aplicacoes.MsProMobile).Returns(0);
            clientMock.GetByFilters(Arg.Any <Cliente>(), Arg.Any <int>(), Arg.Any <Aplicacoes>()).Returns(clientesMockData);

            versaoMock.GetUltimaVersaoBloqueada((int)Aplicacoes.MsProMobile).Returns(appVersion);

            var business = new AlunoBusiness(new AlunoEntity(), new ClienteEntity(), configMock, versaoMock);

            var aluno = business.GetAcessoAluno(register, senha, (int)Aplicacoes.MsProMobile, appVersion, deviceToken, idDevice);

            var response = business.GetResponse();

            Assert.IsFalse(response.Sucesso);
            Assert.AreEqual(TipoErroAcesso.VersaoAppDesatualizada, response.ETipoErro);
        }
Beispiel #7
0
        public void GetAcessoAlunoUltimaVersaoIonic1_AlunoUsuarioNaoCadastradoVersaoBloqueada_ErroUsuarioNaoCadastrado()
        {
            var    register    = Constants.cadastroInvalido;
            var    senha       = Constants.senhaErrada;
            var    deviceToken = Guid.NewGuid().ToString();
            var    idDevice    = (int)Utilidades.TipoDevice.androidMobile;
            string appVersion  = Utilidades.UltimaVersaoIonic1;

            var configMock = Substitute.For <IConfigData>();
            var versaoMock = Substitute.For <IVersaoAppPermissaoEntityData>();
            var clientMock = Substitute.For <IClienteEntity>();

            configMock.GetDeveBloquearAppVersaoNula().Returns(false);
            configMock.GetTempoInadimplenciaTimeoutParametro().Returns(100);

            clientMock.UserGolden(register, Aplicacoes.MsProMobile).Returns(0);
            clientMock.GetByFilters(Arg.Any <Cliente>(), Arg.Any <int>(), Arg.Any <Aplicacoes>()).Returns(new Clientes());

            var business = new AlunoBusiness(new AlunoEntity(), clientMock, configMock, versaoMock);

            var aluno = business.GetAcessoAluno(register, senha, (int)Aplicacoes.MsProMobile, appVersion, deviceToken, idDevice);

            var response = business.GetResponse();

            Assert.IsFalse(response.Sucesso);
            Assert.AreEqual(TipoErroAcesso.CadastroInexistente, response.ETipoErro);
        }
Beispiel #8
0
        public void GetAcessoAluno_PerfilInexistente_RetornaSemSucesso()
        {
            var aluno = Constants.cadastroInvalido;

            string appVersion = "5.2.0";

            var configMock = Substitute.For <IConfigData>();
            var versaoMock = Substitute.For <IVersaoAppPermissaoEntityData>();

            configMock.GetDeveBloquearAppVersaoNula().Returns(false);
            configMock.GetTempoInadimplenciaTimeoutParametro().Returns(24);

            var business = new AlunoBusiness(new AlunoEntity(), new ClienteEntity(), configMock, versaoMock);

            var alunoRetorno = business.GetAcessoAluno(aluno, (int)Aplicacoes.MsProMobile, appVersion);

            Assert.IsFalse(alunoRetorno.Sucesso);
        }
Beispiel #9
0
        public void GetAcessoAluno_PerfilExtensivoAnoAtual_RetornaAlunoComSucesso()
        {
            var aluno = new PerfilAlunoEntityTestData().GetAlunoExtensivoAnoAtualAtivo();

            string appVersion = null;

            var configMock = Substitute.For <IConfigData>();
            var versaoMock = Substitute.For <IVersaoAppPermissaoEntityData>();

            configMock.GetDeveBloquearAppVersaoNula().Returns(false);
            configMock.GetTempoInadimplenciaTimeoutParametro().Returns(24);

            var business = new AlunoBusiness(new AlunoEntity(), new ClienteEntity(), configMock, versaoMock);

            var alunoRetorno = business.GetAcessoAluno(aluno.Register, (int)Aplicacoes.MsProMobile, appVersion);

            Assert.IsTrue(alunoRetorno.Sucesso);
        }
        public ResultViewModel <LoginViewModel> GetAcessoAluno()
        {
            Request.Headers.TryGetValue("appVersion", out StringValues appVersion);
            Request.Headers.TryGetValue("idAplicacao", out StringValues idAplicacao);
            Request.Headers.TryGetValue("register", out StringValues register);
            Request.Headers.TryGetValue("senha", out StringValues senha);
            Request.Headers.TryGetValue("tokenDevice", out StringValues tokenDevice);
            Request.Headers.TryGetValue("idDevice", out StringValues idDevice);

            var alunoBusiness = new AlunoBusiness(new AlunoEntity(), new ClienteEntity(), new ConfigEntity(), new VersaoAppPermissaoEntity());

            var result = Execute(() =>
            {
                var acessoAluno = alunoBusiness.GetAcessoAluno(register, senha, Convert.ToInt32(idAplicacao), appVersion, tokenDevice, Convert.ToInt32(idDevice));
                return(acessoAluno);
            }, true);

            return(GetResultViewModel <LoginViewModel, AlunoMedsoft>(result, alunoBusiness.GetResponse()));
        }
Beispiel #11
0
        public void GetAcessoAluno_AlunoR4TegoAtivo_PermiteAcesso()
        {
            var aluno    = new PerfilAlunoEntityTestData().GetAlunoSomenteUmaOV(DateTime.Now.Year, (int)Produto.Produtos.TEGO, (int)OrdemVenda.StatusOv.Ativa, (int)OrdemVenda.StatusOv.Adimplente);;
            var clientes = new ClienteEntity().GetByFilters(new Cliente {
                Register = aluno.Register
            }, aplicacao: Aplicacoes.MsProMobile);

            var idDevice = (int)Utilidades.TipoDevice.androidMobile;

            var configMock = Substitute.For <IConfigData>();
            var versaoMock = Substitute.For <IVersaoAppPermissaoEntityData>();
            var clientMock = Substitute.For <IClienteEntity>();

            configMock.GetDeveBloquearAppVersaoNula().Returns(false);
            configMock.GetTempoInadimplenciaTimeoutParametro().Returns(24);
            clientMock.UserGolden(Arg.Any <string>(), Arg.Any <Aplicacoes>()).Returns(1);
            clientMock.GetByFilters(Arg.Any <Cliente>(), Arg.Any <int>(), Arg.Any <Aplicacoes>()).Returns(clientes);

            var business = new AlunoBusiness(new AlunoEntity(), clientMock, configMock, versaoMock);

            var alunoRetorno = business.GetAcessoAluno(aluno.Register, "", (int)Aplicacoes.MsProMobile, null, "", idDevice);

            Assert.IsTrue(alunoRetorno.PermiteAcesso);
        }