public void GetInexistentCountry() { //Prueba el comportamiento cuando no existe país. CountryBLL countryBll = new CountryBLL(); ResultBM result = countryBll.GetCountry("XX"); CountryBM country = result.GetValue <CountryBM>(); Assert.IsNull(country, "El país con iso2 XX no debería existir"); }
public void GetCountry() { //Prueba que pueda recuperar el país pasado por parámetro. CountryBLL countryBll = new CountryBLL(); ResultBM result = countryBll.GetCountry("AR"); CountryBM country = result.GetValue <CountryBM>(); Assert.IsNotNull(country, "Debería haber recuperado el país argentina"); Assert.AreEqual(country.iso2, "AR", "Debería existir AR"); Assert.AreEqual(country.Name, "Argentina", "Debería ser Argentina"); }
private Country ConvertToDM(CountryBM model) { return(new Country { CountryId = model.CountryId, Name = model.Name, CreatedBy = model.CreatedBy, CreationDate = model.CreationDate, ModifiedBy = model.ModifiedBy, ModificationDate = model.ModificationDate }); }
private ResultBM create_invalid_person(PersonBM personBm) { CountryBLL countryBll = new CountryBLL(); ResultBM result = countryBll.GetCountry("AR"); CountryBM countryBm = result.GetValue <CountryBM>(); AddressBLL addressBll = new AddressBLL(); AddressBM addressBm = new AddressBM("Calle test", 999, "Departamento", "Barrio", "Esta es una dirección creada mediante test", countryBm); PersonBLL personBll = new PersonBLL(); return(personBll.SavePerson(personBm)); }
public void CreateAddress() { //Prueba la creación de una dirección CountryBLL countryBll = new CountryBLL(); ResultBM result = countryBll.GetCountry("AR"); CountryBM countryBm = result.GetValue <CountryBM>(); AddressBLL addressBll = new AddressBLL(); AddressBM addressBm = new AddressBM("Calle test", 999, "Departamento", "Barrio", "Esta es una dirección creada mediante test", countryBm); ResultBM addressResult = addressBll.SaveAddress(addressBm); Assert.IsTrue(addressResult.IsValid(), "Debería haberse guardado"); }
public void CreateAddressFailsNumber() { //Prueba la validación del número CountryBLL countryBll = new CountryBLL(); ResultBM result = countryBll.GetCountry("AR"); CountryBM countryBm = result.GetValue <CountryBM>(); AddressBLL addressBll = new AddressBLL(); AddressBM addressBm = new AddressBM("Calle test", -1, "Departamento", "Barrio", "Esta es una dirección creada mediante test", countryBm); ResultBM addressResult = addressBll.SaveAddress(addressBm); Assert.IsTrue(addressResult.IsCurrentError(ResultBM.Type.INCOMPLETE_FIELDS), "No debería haber sido válido."); Assert.IsTrue(addressResult.description.Contains("calle"), "No debería haber sido válido."); }
private PersonBM create_person() { CountryBLL countryBll = new CountryBLL(); ResultBM result = countryBll.GetCountry("AR"); CountryBM countryBm = result.GetValue <CountryBM>(); AddressBLL addressBll = new AddressBLL(); AddressBM addressBm = new AddressBM("Calle test", 999, "Departamento", "Barrio", "Esta es una dirección creada mediante test", countryBm); PersonBLL personBll = new PersonBLL(); PersonBM personBm = new PersonBM("Name test", "lastname test", DateTime.Now, "mail", "1553489636", 'M', 29192646, addressBm); ResultBM saveResult = personBll.SavePerson(personBm); Assert.IsTrue(saveResult.IsValid(), "La persona debería haberse creado"); return(saveResult.GetValue <PersonBM>()); }
/// <summary> /// Devuelve el país para el iso2 requerido /// </summary> /// <param name="iso2"></param> /// <returns></returns> public ResultBM GetCountry(string iso2) { try { CountryDAL countryDal = new CountryDAL(); CountryDTO countryDto = countryDal.GetCountry(iso2); CountryBM countryBm = null; if (countryDto != null) { countryBm = new CountryBM(countryDto); } return(new ResultBM(ResultBM.Type.OK, "Operación exitosa.", countryBm)); } catch (Exception exception) { return(new ResultBM(ResultBM.Type.EXCEPTION, SessionHelper.GetTranslation("RETRIEVING_ERROR") + " " + exception.Message, exception)); } }
public void Update(CountryBM model) { uow.CountryRepository.Update(ConvertToDM(model)); uow.Save(); }
public void Create(CountryBM model) { uow.CountryRepository.Add(ConvertToDM(model)); uow.Save(); }