public IVoluntario GetVoluntarioById(string Id)
        {
            IVoluntario ret = null;

            using (var tracer = new CrossCutting.IoCManager.CentralTrace.Business.Publisher.CentralTracerBusinessIoCManager(_conf).GetITraceBusinessCurrentImplementation(RequestId))
            {
                Expression <Func <IVoluntario, bool> > filter = x => x.Id.Equals(Id);
                ret = base.Context.VoluntarioCollection.Find(filter).First();
            }
            return(ret);
        }
Exemplo n.º 2
0
        public void TestVoluntarioModelInjection()
        {
            IVoluntario     voluntario = null;
            ModelIoCManager iocManager = new ModelIoCManager(base.Config);

            voluntario = iocManager.GetIVoluntarioCurrentImplementation();

            Assert.IsNotNull(voluntario);

            Assert.IsTrue(voluntario.GetType().IsClass);
        }
        public IVoluntario GetVoluntarioById(string Id)
        {
            IVoluntario vol = null;

            using (var tracer = new CrossCutting.IoCManager.CentralTrace.Business.Publisher.CentralTracerBusinessIoCManager(_conf).GetITraceBusinessCurrentImplementation(RequestId))
            {
                base.Context.VoluntarioCollection.EnsureIndex(x => x.Id);
                vol = base.Context.VoluntarioCollection.Query()
                      .Where(c => c.Id == Id)
                      .FirstOrDefault();
            }
            return(vol);
        }
        public IVoluntario GetCurrentImplementation()
        {
            IVoluntario obj = null;

            foreach (var type in typeof(IVoluntario).Assembly.DefinedTypes)
            {
                if (type.IsClass && type.FullName.EndsWith(_currentImplementation))
                {
                    obj = (IVoluntario)Assembly.Load(typeof(IVoluntario).Assembly.FullName).CreateInstance(type.FullName);
                    break;
                }
            }
            return(obj);
        }
Exemplo n.º 5
0
        public void Setup()
        {
            ser = new CrossCutting.IoCManager.Voluntario.SerializationManager.SerializationIoCManager(base.Config).GetJSonCurrentImplementation();

            voluntario                = new Voluntario.IoCManager.Model.ModelIoCManager(base.Config).GetIVoluntarioCurrentImplementation();
            voluntario.Cep            = "11703680";
            voluntario.Cpf            = 31495307840;
            voluntario.DataNascimento = "16/02/1982";
            voluntario.Email          = "*****@*****.**";
            voluntario.Id             = Guid.NewGuid().ToString();
            voluntario.Nome           = "Leandro Figueiredo Silva Ribeiro";
            voluntario.Senha          = "Senha";
            voluntario.Telefone       = "12323123";
            voluntario.AreasInteresse = new List <string>()
            {
                "teste01", "teste02"
            };
            voluntario.FotoBase64 = Convert.ToBase64String(new byte[] { 0, 1, 33, 56, 87, 19 });
        }
        public void GetById()
        {
            IVoluntario obj = null;
            string      id  = ListaAll()[0].Id;

            using (IQueryApplication qry = new CrossCutting.IoCManager.Voluntario.Application.Query.QueryApplicationIoCManager(base.Config).GetCurrentIQueryApplicationImplementation())
            {
                qry.RequestId    = RequestId;
                qry.VoluntarioId = id;
                try
                {
                    obj = qry.GetById();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }

            Assert.IsNotNull(obj);
            Assert.IsNotEmpty(obj.Id);
        }