public void TestarArquivoExistente()
        {
            //Given
            ArquivoBO arquivoBO   = new ArquivoBO();
            Arquivo   arquivo     = new Arquivo();
            string    nomeArquivo = "Horario GDS";

            //When
            arquivo = arquivoBO.BuscarArquivoPorNome(nomeArquivo);

            //Then
            Assert.AreEqual(nomeArquivo, arquivo.Nome);
        }
Example #2
0
        private void dgvMetodos_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0 && dgvMetodos.Rows[e.RowIndex].Cells["coluna1"].Value != null)
            {
                ArquivoBO arquivoBO = new ArquivoBO();
                Arquivo   arquivo   = new Arquivo();

                string nomeMetodo = dgvMetodos.Rows[e.RowIndex].Cells["coluna1"].Value.ToString();

                arquivo = arquivoBO.BuscarArquivoPorNome(nomeMetodo);

                if (arquivo != null)
                {
                    txtNome.Text   = arquivo.Nome;
                    txtUrl.Text    = arquivo.Url_Conexao;
                    cmbMetodo.Text = arquivo.Tipo_Requisicao;

                    if (arquivo.Tipo_Requisicao == MetodosWebService.POST.ToString())
                    {
                        lblBody.Visible = true;
                        rtbBody.Visible = true;
                    }
                    else
                    {
                        lblBody.Visible = false;
                        rtbBody.Visible = false;
                    }

                    if (arquivo.Sem_Autenticacao)
                    {
                        rdbSemAutenticacao.Checked = true;

                        txtHeaderKeyA.Enabled   = false;
                        txtHeaderValueA.Enabled = false;
                        txtHeaderKeyB.Visible   = false;
                        txtHeaderValueB.Visible = false;

                        txtHeaderKeyA.Text   = "";
                        txtHeaderValueA.Text = "";
                    }
                    else if (arquivo.Com_Autenticacao)
                    {
                        rdbUserPass.Checked = true;

                        txtHeaderKeyA.Enabled   = true;
                        txtHeaderValueA.Enabled = true;
                        txtHeaderKeyB.Visible   = false;
                        txtHeaderValueB.Visible = false;

                        txtHeaderKeyA.Text   = arquivo.User_0;
                        txtHeaderValueA.Text = arquivo.Password_0;
                    }
                    else if (arquivo.Autenticacao_Basic)
                    {
                        rdbBasic.Checked = true;

                        txtHeaderKeyA.Enabled   = true;
                        txtHeaderValueA.Enabled = true;
                        txtHeaderKeyB.Visible   = false;
                        txtHeaderValueB.Visible = false;

                        txtHeaderKeyA.Text   = arquivo.User_0;
                        txtHeaderValueA.Text = arquivo.Password_0;
                    }
                    else
                    {
                        rdbHeader.Checked = true;

                        txtHeaderKeyA.Enabled   = true;
                        txtHeaderValueA.Enabled = true;

                        txtHeaderKeyB.Visible   = true;
                        txtHeaderValueB.Visible = true;
                        txtHeaderKeyB.Enabled   = true;
                        txtHeaderValueB.Enabled = true;

                        txtHeaderKeyA.Text   = arquivo.User_0;
                        txtHeaderValueA.Text = arquivo.Password_0;

                        if (!string.IsNullOrEmpty(arquivo.User_1) && !string.IsNullOrEmpty(arquivo.Password_1))
                        {
                            txtHeaderKeyB.Text   = arquivo.User_1;
                            txtHeaderValueB.Text = arquivo.Password_1;
                        }
                    }

                    txtContent.Text = arquivo.Content_Type;
                    txtAgent.Text   = arquivo.User_Agent;

                    this.BuscarDadosWebService();
                }
            }
        }