public void TestSetup() { AssociadoDbInit db = new AssociadoDbInit(); System.Data.Entity.Database.SetInitializer(db); Repo = new AssociadoRepository(); }
public CheckOutPagSeguro getDadosParaCheckOutPagSeguro(int associadoId, string tipoEndereco, int anoInicio, int anoTermino, bool enderecoRequerido, bool isAnuidade) { CheckOutPagSeguro _check = new CheckOutPagSeguro(); try { AssociadoRepository associadoRepository = new AssociadoRepository(); Associado a = associadoRepository.GetAssociadoById(associadoId); if (a != null) { string _codeArea = ""; string _telefone = ""; if (!string.IsNullOrWhiteSpace(a.NrCelular)) { _codeArea = a.NrCelular.Substring(0, 2); _telefone = a.NrCelular.Substring(2); } string _eMail = ""; _eMail = pS_IsDebug == "true" ? pS_CompradorTeste : a.EMail; Endereco e = new Endereco(); if (a.EnderecosPessoa != null) { List <Endereco> lst = new List <Endereco>(); foreach (var end in a.EnderecosPessoa) { if (end.TipoEndereco == tipoEndereco) { e = end; } } } _check = new CheckOutPagSeguro() { Currency = "", ItemId1 = "", ItemDescription1 = "", ItemAmount1 = "0.00", ItemQuantity1 = "", ItemWeight1 = "", Reference = "", SenderName = a.Nome, SenderAreaCode = _codeArea, SenderPhone = _telefone, SenderEmail = _eMail, ShippingType = "1", ShippingAddressRequired = "true", ShippingAddressStreet = e.Logradouro, ShippingAddressNumber = e.Numero, ShippingAddressComplement = e.Complemento, ShippingAddressDistrict = e.Bairro, ShippingAddressPostalCode = e.Cep, ShippingAddressCity = e.Cidade, ShippingAddressState = e.Estado, ShippingAddressCountry = "BRA" }; } } catch (Exception ex) { throw ex; } return(_check); }