Beispiel #1
0
        public void RebeldeCorrecto()
        {
            Rebelds rebelde = new Rebelds("Maria", "Mercurio");

            Assert.IsNotNull(rebelde);
            Assert.IsTrue(!string.IsNullOrEmpty(rebelde.Name));
        }
Beispiel #2
0
        public void RebeldeIncorrectoVacio()
        {
            Rebelds rebelde = new Rebelds("", "");

            Assert.IsNotNull(rebelde);
            Assert.IsTrue(string.IsNullOrEmpty(rebelde.Planet));
        }
Beispiel #3
0
        public void RebeldeIncorrectoPrimerVacio()
        {
            Rebelds rebelde = new Rebelds("", "Saturno");

            Assert.IsNotNull(rebelde);
            Assert.IsTrue(string.IsNullOrEmpty(rebelde.Name));
        }
Beispiel #4
0
 public Rebelds CreateRebeld(StringCollection collection)
 {
     try
     {
         var cadena = _split.Convert(collection[0], ',');
         _rebelde = new Rebelds(cadena[0], cadena[1]);
     }
     catch (Exception ex)
     {
         throw new FactoryException("No se ha podido crear el objeto de rebelde", ex);
     }
     return(_rebelde);
 }
Beispiel #5
0
 public void CreateStringCollection(StringCollection rebeldes)
 {
     try
     {
         Rebelds obj          = _factory.CreateRebeld(rebeldes);
         var     ExistingList = Lista.ToList();
         ExistingList.Add(obj);
         var result = ExistingList.ToString();
         _log.WriteLog(result);
     }
     catch (Exception ex)
     {
         throw new FactoryException("No se ha podido listar todos los rebeldes", ex);
     }
 }
Beispiel #6
0
        public IEnumerable <Rebelds> CreateListRebelds(StringCollection collection)
        {
            try
            {
                foreach (var item in collection)
                {
                    var cadena = _split.Convert(item, ',');
                    _listRebelds.Append(Rebeld = new Rebelds(cadena[0], cadena[1]));
                }
            }
            catch (Exception ex)
            {
                throw new FactoryException("No se ha podido crear la lista de rebeldes", ex);
            }

            return(_listRebelds);
        }
        public bool IsSatisfiedBy(Rebelds registroRebelde)
        {
            var resultado = false;

            try
            {
                if (!string.IsNullOrEmpty(registroRebelde.Name) && !string.IsNullOrWhiteSpace(registroRebelde.Name) &&
                    !string.IsNullOrEmpty(registroRebelde.Planet) && !string.IsNullOrWhiteSpace(registroRebelde.Planet))
                {
                    resultado = true;
                }
            }
            catch (Exception ex)
            {
                throw new ValidationException("No se han podido validar los rebeldes", ex);
            }
            return(resultado);
        }
Beispiel #8
0
 public Rebelds CreateRebeld(StringCollection collection)
 {
     try
     {
         var cadena = _split.Convert(collection[0], ',');
         _rebelde = new Rebelds(cadena[0], cadena[1]);
         if (_validationRegisterSpecification.IsSatisfiedBy(_rebelde) == true)
         {
             return(_rebelde);
         }
         else
         {
             throw new FactoryException("No se ha podido crear el objeto ");
         }
     }
     catch (Exception ex)
     {
         throw new FactoryException("No se ha podido crear el objeto de rebelde", ex);
     }
     return(_rebelde);
 }