Exemplo n.º 1
0
        public VolunteerDTO GetVolunteer(int volunteerId)
        {
            try
            {
                //Requires.NotNegative("volunteerId", volunteerId);

                log.Debug("volunteerId: " + volunteerId + " ");

                // get
                R_Volunteer t = Repository.GetVolunteer(volunteerId);

                VolunteerDTO dto = new VolunteerDTO(t);

                log.Debug(VolunteerDTO.FormatVolunteerDTO(dto));

                return(dto);
            }
            catch (System.Exception e)
            {
                // error
                log.Error(e.ToString());

                throw;
            }
        }
Exemplo n.º 2
0
        public VolunteerDTO UpdateDTO(VolunteerDTO dto, int?updateBy)
        {
            if (dto != null)
            {
                dto.VolunteerId           = this.VolunteerId;
                dto.Name                  = this.Name;
                dto.Gender                = this.Gender;
                dto.BirthDate             = this.BirthDate;
                dto.Occupation            = this.Occupation;
                dto.Employer              = this.Employer;
                dto.Phone                 = this.Phone;
                dto.Email                 = this.Email;
                dto.IdentityCardNumber    = this.IdentityCardNumber;
                dto.CountryId             = this.CountryId;
                dto.FriendOrFamilyContact = this.FriendOrFamilyContact;
                dto.Photo                 = this.Photo;
                dto.AddressId             = this.AddressId;
                dto.HasCar                = this.HasCar;
                dto.HasDriverLicense      = this.HasDriverLicense;
                dto.HasBike               = this.HasBike;
                dto.VehicleMake           = this.VehicleMake;
                dto.VehicleModel          = this.VehicleModel;
                dto.Active                = this.Active;
                dto.IsDeleted             = this.IsDeleted;

                dto.UpdateBy = updateBy;
                dto.UpdateOn = System.DateTime.UtcNow;
            }

            return(dto);
        }
Exemplo n.º 3
0
 public VolunteerViewModel(VolunteerDTO t, string editUrl)
 {
     VolunteerId           = t.VolunteerId;
     Name                  = t.Name;
     Gender                = t.Gender;
     BirthDate             = t.BirthDate;
     Occupation            = t.Occupation;
     Employer              = t.Employer;
     Phone                 = t.Phone;
     Email                 = t.Email;
     IdentityCardNumber    = t.IdentityCardNumber;
     CountryId             = t.CountryId;
     FriendOrFamilyContact = t.FriendOrFamilyContact;
     Photo                 = t.Photo;
     AddressId             = t.AddressId;
     HasCar                = t.HasCar;
     HasDriverLicense      = t.HasDriverLicense;
     HasBike               = t.HasBike;
     VehicleMake           = t.VehicleMake;
     VehicleModel          = t.VehicleModel;
     Active                = t.Active;
     IsDeleted             = t.IsDeleted;
     CreateBy              = t.CreateBy;
     CreateOn              = t.CreateOn;
     UpdateBy              = t.UpdateBy;
     UpdateOn              = t.UpdateOn;
     EditUrl               = editUrl;
 }
Exemplo n.º 4
0
        public void GetVolunteersPaged_Success_Test()
        {
            // Arrange
            string searchTerm = "";
            int    pageIndex  = 0;
            int    pageSize   = 10;

            // list
            IList <R_Volunteer> list = new List <R_Volunteer>();

            for (int i = 1; i <= pageSize; i++)
            {
                list.Add(SampleVolunteer(i));
            }

            // create mock for repository
            var mock = new Mock <IVolunteerRepository>();

            mock.Setup(s => s.GetVolunteers(Moq.It.IsAny <string>(), Moq.It.IsAny <int>(), Moq.It.IsAny <int>())).Returns(list);

            // service
            VolunteerService volunteerService = new VolunteerService();

            VolunteerService.Repository = mock.Object;

            // Act
            var          resultList = volunteerService.GetVolunteers(searchTerm, pageIndex, pageSize);
            VolunteerDTO result     = resultList.FirstOrDefault();

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.VolunteerId);
            Assert.AreEqual(10, resultList.Count);
        }
Exemplo n.º 5
0
        public void GetVolunteers_Success_Test()
        {
            // Arrange
            R_Volunteer volunteer = SampleVolunteer(1);

            IList <R_Volunteer> list = new List <R_Volunteer>();

            list.Add(volunteer);

            // create mock for repository
            var mock = new Mock <IVolunteerRepository>();

            mock.Setup(s => s.GetVolunteers()).Returns(list);

            // service
            VolunteerService volunteerService = new VolunteerService();

            VolunteerService.Repository = mock.Object;

            // Act
            var          resultList = volunteerService.GetVolunteers();
            VolunteerDTO result     = resultList.FirstOrDefault();

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.VolunteerId);
        }
Exemplo n.º 6
0
        public int AddVolunteer(VolunteerDTO dto)
        {
            int id = 0;

            try
            {
                log.Debug(VolunteerDTO.FormatVolunteerDTO(dto));

                R_Volunteer t = VolunteerDTO.ConvertDTOtoEntity(dto);

                // add
                id = Repository.AddVolunteer(t);
                dto.VolunteerId = id;

                log.Debug("result: 'success', id: " + id);
            }
            catch (System.Exception e)
            {
                // error
                log.Error(e.ToString());

                throw;
            }

            return(id);
        }
Exemplo n.º 7
0
        private VolunteerDTO Create(VolunteerViewModel viewModel)
        {
            try
            {
                log.Debug(VolunteerViewModel.FormatVolunteerViewModel(viewModel));

                VolunteerDTO volunteer = new VolunteerDTO();

                // copy values
                viewModel.UpdateDTO(volunteer, null); //RequestContext.Principal.Identity.GetUserId());

                // audit
                volunteer.CreateBy = null; //RequestContext.Principal.Identity.GetUserId();
                volunteer.CreateOn = DateTime.UtcNow;

                // add
                log.Debug("_volunteerService.AddVolunteer - " + VolunteerDTO.FormatVolunteerDTO(volunteer));

                int id = _volunteerService.AddVolunteer(volunteer);

                volunteer.VolunteerId = id;

                log.Debug("result: 'success', id: " + id);

                return(volunteer);
            }
            catch (Exception e)
            {
                // error
                log.Error(e.ToString());

                throw;
            }
        }
Exemplo n.º 8
0
        public static VolunteerDTO SampleVolunteerDTO(int id = 1)
        {
            VolunteerDTO volunteer = new VolunteerDTO();

            // int
            volunteer.VolunteerId = id;
            // string
            volunteer.Name = "NameTestValue";
            // int?
            volunteer.Gender = 1;
            // System.DateTime?
            volunteer.BirthDate = new System.DateTime();
            // string
            volunteer.Occupation = "OccupationTestValue";
            // string
            volunteer.Employer = "EmployerTestValue";
            // string
            volunteer.Phone = "PhoneTestValue";
            // string
            volunteer.Email = "EmailTestValue";
            // string
            volunteer.IdentityCardNumber = "IdentityCardNumberTestValue";
            // int?
            volunteer.CountryId = 1;
            // string
            volunteer.FriendOrFamilyContact = "FriendOrFamilyContactTestValue";
            // int?
            volunteer.Photo = 1;
            // int?
            volunteer.AddressId = 1;
            // bool
            volunteer.HasCar = false;
            // bool
            volunteer.HasDriverLicense = false;
            // bool
            volunteer.HasBike = false;
            // string
            volunteer.VehicleMake = "VehicleMakeTestValue";
            // string
            volunteer.VehicleModel = "VehicleModelTestValue";
            // bool
            volunteer.Active = false;
            // bool
            volunteer.IsDeleted = false;
            // int?
            volunteer.CreateBy = 1;
            // System.DateTime?
            volunteer.CreateOn = new System.DateTime();
            // int?
            volunteer.UpdateBy = 1;
            // System.DateTime?
            volunteer.UpdateOn = new System.DateTime();

            return(volunteer);
        }
Exemplo n.º 9
0
 public VolunteerBM(VolunteerDTO volunteerDto)
 {
     this.id          = volunteerDto.id;
     this.name        = volunteerDto.name;
     this.lastName    = volunteerDto.lastName;
     this.Birthdate   = volunteerDto.birthdate;
     this.Email       = volunteerDto.email;
     this.phone       = volunteerDto.phone;
     this.gender      = volunteerDto.gender;
     this.dni         = volunteerDto.dni;
     this.volunteerId = volunteerDto.volunteerId;
 }
Exemplo n.º 10
0
        public bool SaveVolunteer(VolunteerDTO volunteerDto)
        {
            DBSql  dbsql = new DBSql();
            String sql;

            sql  = "INSERT INTO volunteer (personId, branchId, userId) VALUES (";
            sql += volunteerDto.id + ", ";
            sql += volunteerDto.branchId + ", ";
            sql += volunteerDto.userId != 0 ? volunteerDto.userId.ToString() : "null";
            sql += ");SELECT @@IDENTITY";
            volunteerDto.volunteerId = dbsql.ExecuteNonQuery(sql);
            return(true);
        }
Exemplo n.º 11
0
        public async Task <object> UpdateVolunteer(VolunteerDTO volunteerDTO, Guid Id)
        {
            try
            {
                var update = await dataContext.volunteers.Where(p => p.Id == Id).FirstOrDefaultAsync();

                if (update != null)
                {
                    update.Address          = volunteerDTO.Address;
                    update.Comment          = volunteerDTO.Comment;
                    update.CompanyName      = volunteerDTO.CompanyName;
                    update.Country          = volunteerDTO.Country;
                    update.Email            = volunteerDTO.Email;
                    update.FirstName        = volunteerDTO.FirstName;
                    update.Interest         = volunteerDTO.Interest;
                    update.InterestDuration = volunteerDTO.InterestDuration;
                    update.PhoneNumber      = volunteerDTO.PhoneNumber;
                    update.State            = volunteerDTO.State;
                    update.VolunteerPledge  = volunteerDTO.VolunteerPledge;
                    update.LastName         = volunteerDTO.LastName;

                    int result = await dataContext.SaveChangesAsync();

                    if (result > 0)
                    {
                        res.Success = true;
                        res.Message = "Volunteer successfully updated";
                        res.Data    = update;
                        return(res);
                    }
                    else
                    {
                        res.Success = false;
                        res.Message = "Db Error";
                        return(res);
                    }
                }
                else
                {
                    res.Success = false;
                    res.Message = "Volunteer id does not exist";
                    res.Data    = null;
                    return(res);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Exemplo n.º 12
0
 public VolunteerBM(VolunteerDTO volunteerDto, AddressBM addressBm, BranchBM branchBm, UserBM userBm = null)
 {
     this.id          = volunteerDto.id;
     this.name        = volunteerDto.name;
     this.lastName    = volunteerDto.lastName;
     this.Birthdate   = volunteerDto.birthdate;
     this.Email       = volunteerDto.email;
     this.phone       = volunteerDto.phone;
     this.gender      = volunteerDto.gender;
     this.dni         = volunteerDto.dni;
     this.address     = addressBm;
     this.volunteerId = volunteerDto.volunteerId;
     this.branch      = branchBm;
     this.user        = userBm;
 }
Exemplo n.º 13
0
        public async Task <IActionResult> UpdateVolunteer(VolunteerDTO volunteerDTO, Guid Id)
        {
            try
            {
                dynamic result = await _volunteer.UpdateVolunteer(volunteerDTO, Id);

                if (result.Success == false)
                {
                    return(BadRequest(result));
                }
                return(Ok(result));
            }
            catch (Exception ex)
            {
                throw new Exception();
            }
        }
Exemplo n.º 14
0
        public IHttpActionResult CreateVolunteer(VolunteerDTO volunteer)
        {
            var rootNode = Umbraco.ContentAtRoot().OfType <RegisteredPeople>().FirstOrDefault();

            var content = Services.ContentService.Create(volunteer.PersonName, rootNode.Id, Volunteer.ModelTypeAlias);

            content.SetValue(Volunteer.GetModelPropertyType(x => x.PersonName).Alias, volunteer.PersonName);
            content.SetValue(Volunteer.GetModelPropertyType(x => x.Phone).Alias, volunteer.Phone);
            content.SetValue(Volunteer.GetModelPropertyType(x => x.Age).Alias, volunteer.Age);
            content.SetValue(Volunteer.GetModelPropertyType(x => x.HomeAddress).Alias, volunteer.HomeAddress);
            content.SetValue(Volunteer.GetModelPropertyType(x => x.Description).Alias, volunteer.Description);
            content.SetValue(Volunteer.GetModelPropertyType(x => x.Type).Alias, "Volunteer");

            var result = Services.ContentService.Save(content);

            return(HandleContentSave(result));
        }
Exemplo n.º 15
0
        private VolunteerDTO Resolve(List <String> item)
        {
            VolunteerDTO result = new VolunteerDTO();

            result.id          = int.Parse(item[0]);
            result.name        = item[1];
            result.lastName    = item[2];
            result.birthdate   = DateTime.Parse(item[3]);
            result.email       = item[4];
            result.phone       = item[5];
            result.gender      = Char.Parse(item[6]);
            result.dni         = int.Parse(item[7]);
            result.addressId   = int.Parse(item[8]);
            result.volunteerId = int.Parse(item[9]);
            result.branchId    = int.Parse(item[10]);
            result.userId      = int.Parse(item[11].Length == 0 ? "0" : item[11]);
            return(result);
        }
Exemplo n.º 16
0
        public async Task <object> AddVolunteer(VolunteerDTO volunteerDTO, string userID)
        {
            try
            {
                var data = new Volunteer
                {
                    Address          = volunteerDTO.Address,
                    Comment          = volunteerDTO.Comment,
                    CompanyName      = volunteerDTO.CompanyName,
                    Country          = volunteerDTO.Country,
                    Email            = volunteerDTO.Email,
                    FirstName        = volunteerDTO.FirstName,
                    Interest         = volunteerDTO.Interest,
                    InterestDuration = volunteerDTO.InterestDuration,
                    LastName         = volunteerDTO.LastName,
                    PhoneNumber      = volunteerDTO.PhoneNumber,
                    State            = volunteerDTO.State,
                    VolunteerPledge  = volunteerDTO.VolunteerPledge,
                    UserId           = userID,
                    DateCreated      = DateTime.Now
                };
                await dataContext.AddAsync(data);

                int result = await dataContext.SaveChangesAsync();

                if (result > 0)
                {
                    res.Success = true;
                    res.Data    = "Ok";
                    return(res);
                }
                else
                {
                    res.Success = false;
                    res.Message = "Db Error";
                    return(res);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Exemplo n.º 17
0
        public void UpdateVolunteer_Success_Test()
        {
            // Arrange
            VolunteerDTO dto = SampleVolunteerDTO(1);

            // create mock for repository
            var mock = new Mock <IVolunteerRepository>();

            mock.Setup(s => s.UpdateVolunteer(Moq.It.IsAny <R_Volunteer>())).Verifiable();

            // service
            VolunteerService volunteerService = new VolunteerService();

            VolunteerService.Repository = mock.Object;

            // Act
            volunteerService.UpdateVolunteer(dto);

            // Assert
            Assert.IsNotNull(dto);
        }
Exemplo n.º 18
0
        public async Task <IActionResult> AddVolunteer(VolunteerDTO volunteerDTO)
        {
            try
            {
                //var userid = _accessor.HttpContext.User.Claims.Where(c => c.Type == ClaimTypes.NameIdentifier).SingleOrDefault();

                var     UserId = "B7C60175-B370-4CE4-AC86-08D81D38F5FE";
                dynamic result = await _volunteer.AddVolunteer(volunteerDTO, UserId);

                if (result.Success == false)
                {
                    return(BadRequest(result));
                }

                return(Ok(result));
            }
            catch (Exception ex)
            {
                throw new Exception();
            }
        }
Exemplo n.º 19
0
        public ResultBM SaveVolunteer(VolunteerBM volunteerBm)
        {
            try
            {
                PersonBLL    personBll = new PersonBLL();
                PersonBM     personBm  = null;
                ResultBM     personResult;
                VolunteerDAL volunteerDal = new VolunteerDAL();
                VolunteerDTO volunteerDto = null;

                ResultBM validResult = IsValid(volunteerBm);

                if (validResult.IsValid())
                {
                    personResult = personBll.SavePerson(volunteerBm);

                    if (personResult.IsValid())
                    {
                        personBm     = personResult.GetValue() as PersonBM;
                        volunteerDto = new VolunteerDTO(personBm.id, volunteerBm.branch.id, volunteerBm.user == null ? 0 : volunteerBm.user.Id);
                        volunteerDal.SaveVolunteer(volunteerDto);
                        volunteerBm.volunteerId = volunteerDto.volunteerId;

                        return(new ResultBM(ResultBM.Type.OK, "Voluntario guardado.", volunteerBm));
                    }
                    else
                    {
                        return(personResult);
                    }
                }
                else
                {
                    return(validResult);
                }
            }
            catch (Exception exception)
            {
                return(new ResultBM(ResultBM.Type.EXCEPTION, "Se ha producido un error al guardar el volunatio.", exception));
            }
        }
Exemplo n.º 20
0
        private VolunteerDTO Update(VolunteerViewModel viewModel)
        {
            try
            {
                log.Debug(VolunteerViewModel.FormatVolunteerViewModel(viewModel));

                // get
                log.Debug("_volunteerService.GetVolunteer - volunteerId: " + viewModel.VolunteerId + " ");

                var existingVolunteer = _volunteerService.GetVolunteer(viewModel.VolunteerId);

                log.Debug("_volunteerService.GetVolunteer - " + VolunteerDTO.FormatVolunteerDTO(existingVolunteer));

                if (existingVolunteer != null)
                {
                    // copy values
                    viewModel.UpdateDTO(existingVolunteer, null); //RequestContext.Principal.Identity.GetUserId());

                    // update
                    log.Debug("_volunteerService.UpdateVolunteer - " + VolunteerDTO.FormatVolunteerDTO(existingVolunteer));

                    _volunteerService.UpdateVolunteer(existingVolunteer);

                    log.Debug("result: 'success'");
                }
                else
                {
                    log.Error("existingVolunteer: null, VolunteerId: " + viewModel.VolunteerId);
                }

                return(existingVolunteer);
            }
            catch (Exception e)
            {
                // error
                log.Error(e.ToString());

                throw;
            }
        }
Exemplo n.º 21
0
        public void AddVolunteer_Success_Test()
        {
            // Arrange
            VolunteerDTO dto = SampleVolunteerDTO(1);

            // create mock for repository
            var mock = new Mock <IVolunteerRepository>();

            mock.Setup(s => s.AddVolunteer(Moq.It.IsAny <R_Volunteer>())).Returns(1);

            // service
            VolunteerService volunteerService = new VolunteerService();

            VolunteerService.Repository = mock.Object;

            // Act
            int id = volunteerService.AddVolunteer(dto);

            // Assert
            Assert.AreEqual(1, id);
            Assert.AreEqual(1, dto.VolunteerId);
        }
Exemplo n.º 22
0
        public void DeleteVolunteer(VolunteerDTO dto)
        {
            try
            {
                log.Debug(VolunteerDTO.FormatVolunteerDTO(dto));

                R_Volunteer t = VolunteerDTO.ConvertDTOtoEntity(dto);

                // delete
                Repository.DeleteVolunteer(t);
                dto.IsDeleted = t.IsDeleted;

                log.Debug("result: 'success'");
            }
            catch (System.Exception e)
            {
                // error
                log.Error(e.ToString());

                throw;
            }
        }
Exemplo n.º 23
0
        public void GetVolunteer_Success_Test()
        {
            // Arrange
            int         id        = 1;
            R_Volunteer volunteer = SampleVolunteer(id);

            // create mock for repository
            var mock = new Mock <IVolunteerRepository>();

            mock.Setup(s => s.GetVolunteer(Moq.It.IsAny <int>())).Returns(volunteer);

            // service
            VolunteerService volunteerService = new VolunteerService();

            VolunteerService.Repository = mock.Object;

            // Act
            VolunteerDTO result = volunteerService.GetVolunteer(id);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.VolunteerId);
        }
Exemplo n.º 24
0
        public void UpdateVolunteer(VolunteerDTO dto)
        {
            try
            {
                //Requires.NotNull(t);
                //Requires.PropertyNotNegative(t, "VolunteerId");

                log.Debug(VolunteerDTO.FormatVolunteerDTO(dto));

                R_Volunteer t = VolunteerDTO.ConvertDTOtoEntity(dto);

                // update
                Repository.UpdateVolunteer(t);

                log.Debug("result: 'success'");
            }
            catch (System.Exception e)
            {
                // error
                log.Error(e.ToString());

                throw;
            }
        }
Exemplo n.º 25
0
        public ResultBM GetVolunteer(int volunteerId)
        {
            try {
                AddressBLL   addressBll    = new AddressBLL();
                ResultBM     addressResult = null;
                AddressBM    addressBm     = null;
                BranchBLL    branchBll     = new BranchBLL();
                ResultBM     branchResult  = null;
                BranchBM     branchBm      = null;
                UserBLL      userBll       = new UserBLL();
                ResultBM     userResult    = null;
                UserBM       userBm        = null;
                VolunteerDAL volunteerDal  = new VolunteerDAL();
                VolunteerBM  volunteerBm   = null;
                VolunteerDTO volunteerDto  = volunteerDal.GetVolunteer(volunteerId);

                if (volunteerDto != null)
                {
                    //Debería existir
                    addressResult = addressBll.GetAddress(volunteerDto.addressId);
                    if (!addressResult.IsValid())
                    {
                        return(addressResult);
                    }
                    if (addressResult.GetValue() == null)
                    {
                        throw new Exception("La dirección " + volunteerDto.addressId + " para el voluntario " + volunteerId + " no existe.");
                    }
                    addressBm = addressResult.GetValue <AddressBM>();

                    branchResult = branchBll.GetBranch(volunteerDto.branchId);
                    if (!branchResult.IsValid())
                    {
                        return(branchResult);
                    }
                    if (branchResult.GetValue() == null)
                    {
                        throw new Exception("La sede " + volunteerDto.branchId + " para el voluntario " + volunteerId + " no existe.");
                    }
                    branchBm = branchResult.GetValue <BranchBM>();

                    //El usuario podría no existir porque el voluntario no requiere necesariamente que se lo asocie
                    //con un susuario de sistema
                    userResult = userBll.GetUser(volunteerDto.userId);
                    if (!userResult.IsValid())
                    {
                        return(userResult);
                    }

                    if (userResult.GetValue() != null)
                    {
                        userBm = userResult.GetValue <UserBM>();
                    }

                    volunteerBm = new VolunteerBM(volunteerDto, addressBm, branchBm, userBm);
                }

                return(new ResultBM(ResultBM.Type.OK, "Operación exitosa.", volunteerBm));
            }
            catch (Exception exception) {
                return(new ResultBM(ResultBM.Type.EXCEPTION, "Se ha producido un error al recuperar el voluntario " + volunteerId + ".", exception));
            }
        }
Exemplo n.º 26
0
        public void GetVolunteerListAdvancedSearch_Success_Test()
        {
            // Arrange
            string name   = null;
            int?   gender = null;

            System.DateTime?birthDateFrom         = null;
            System.DateTime?birthDateTo           = null;
            string          occupation            = null;
            string          employer              = null;
            string          phone                 = null;
            string          email                 = null;
            string          identityCardNumber    = null;
            int?            countryId             = null;
            string          friendOrFamilyContact = null;
            int?            photo                 = null;
            int?            addressId             = null;
            bool?           hasCar                = null;
            bool?           hasDriverLicense      = null;
            bool?           hasBike               = null;
            string          vehicleMake           = null;
            string          vehicleModel          = null;
            bool?           active                = null;

            //int pageIndex = 0;
            int pageSize = 10;

            // list
            IList <R_Volunteer> list = new List <R_Volunteer>();

            for (int i = 1; i <= pageSize; i++)
            {
                list.Add(SampleVolunteer(i));
            }

            // create mock for repository
            var mock = new Mock <IVolunteerRepository>();

            mock.Setup(s => s.GetVolunteerListAdvancedSearch(
                           Moq.It.IsAny <string>()             // name
                           , Moq.It.IsAny <int?>()             // gender
                           , Moq.It.IsAny <System.DateTime?>() // birthDateFrom
                           , Moq.It.IsAny <System.DateTime?>() // birthDateTo
                           , Moq.It.IsAny <string>()           // occupation
                           , Moq.It.IsAny <string>()           // employer
                           , Moq.It.IsAny <string>()           // phone
                           , Moq.It.IsAny <string>()           // email
                           , Moq.It.IsAny <string>()           // identityCardNumber
                           , Moq.It.IsAny <int?>()             // countryId
                           , Moq.It.IsAny <string>()           // friendOrFamilyContact
                           , Moq.It.IsAny <int?>()             // photo
                           , Moq.It.IsAny <int?>()             // addressId
                           , Moq.It.IsAny <bool?>()            // hasCar
                           , Moq.It.IsAny <bool?>()            // hasDriverLicense
                           , Moq.It.IsAny <bool?>()            // hasBike
                           , Moq.It.IsAny <string>()           // vehicleMake
                           , Moq.It.IsAny <string>()           // vehicleModel
                           , Moq.It.IsAny <bool?>()            // active
                           )).Returns(list);

            // service
            VolunteerService volunteerService = new VolunteerService();

            VolunteerService.Repository = mock.Object;

            // Act
            var resultList = volunteerService.GetVolunteerListAdvancedSearch(
                name
                , gender
                , birthDateFrom
                , birthDateTo
                , occupation
                , employer
                , phone
                , email
                , identityCardNumber
                , countryId
                , friendOrFamilyContact
                , photo
                , addressId
                , hasCar
                , hasDriverLicense
                , hasBike
                , vehicleMake
                , vehicleModel
                , active
                );

            VolunteerDTO result = resultList.FirstOrDefault();

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.VolunteerId);
        }