public void Register_ValidVolunteer()
        {
            Person moqPerson = new Person()
            {
                Id = 1,
                UserId = null,
                FirstName = "Bob",
                LastName = "Jones",
                Email = "*****@*****.**",
                PhoneNumber = "555-222-9139",
                ClusterId = 1
            };

            var moqDataService = new Mock<IDataService>();
            moqDataService.Setup(s => s.AddPerson(It.IsAny<Person>())).Returns(moqPerson);

            VolunteerService service = new VolunteerService(moqDataService.Object);
            Person actual = service.Register("Bob", "Jones", "*****@*****.**", "555-222-9139", 1, 5);

            Assert.AreEqual(1, actual.Id);
            Assert.AreEqual("Bob", actual.FirstName);
            Assert.AreEqual("Jones", actual.LastName);
            Assert.AreEqual("*****@*****.**", actual.Email);
            Assert.AreEqual("555-222-9139", actual.PhoneNumber);
            Assert.AreEqual(1, actual.ClusterId);
        }
        public ActionResult About()
        {
            var person = new Person {FirstName = "Rob", LastName = "Gray"};
            _personRepository.Save(person);

            return View();
        }
		public async Task<ActionResult> Index()
		{
			var person = new Person
			{
				Id = "1",
				Firstname = "Martijn",
				Lastname = "Laarman"
			};

			_client.Index(person);
			_client.IndexMany(new List<Person> { person, person, person });
			_client.Get<Person>("1");
			_client.DeleteIndex("not-existing-index");
			_client.ClusterHealth();

			using (MiniProfiler.StepStatic("Async"))
			{
				await _client.IndexAsync(person);
				using (MiniProfiler.StepStatic("Async inner 1"))
				{
					await _client.IndexAsync(new List<Person> { person, person, person });
				}
				using (MiniProfiler.StepStatic("Async inner 2"))
				{
					await _client.IndexManyAsync(new List<Person> { person, person, person });
					await _client.GetAsync<Person>("1");
				}
			}

			return View();
		}
        public void GetPersonDetailsForChangeContactInfoThrowsExpectedPersonNotFoundException()
        {
            var personOne = new Person
            {
                Id = 1,
                UserId = 6,
                FirstName = "Cathy",
                LastName = "Jones",
                Email = "*****@*****.**",
                PhoneNumber = "555-222-9139",
                ClusterId = 1
            };

            var personTwo = new Person
            {
                Id = 2,
                UserId = 7,
                FirstName = "Stan",
                LastName = "Smith",
                Email = "*****@*****.**",
                PhoneNumber = "111-333-2222"
            };

            var dataService = new Mock<IDataService>();
            var personList = new List<Person>
            {
                personOne,
                personTwo
            };
            dataService.Setup(x => x.Persons).Returns(personList.AsQueryable());
            var underTest = new VolunteerService(dataService.Object);

            var result = underTest.GetPersonDetailsForChangeContactInfo(8);
        }
        public IHttpActionResult Get(int id)
        {
            var entityPerson = _personRepository.Get(id);

            if (entityPerson == null)
            {
                return(NotFound());
            }

            var entityColours = _colorRepository.GetAll();
            var person        = new Models.Person
            {
                FirstName    = entityPerson.FirstName,
                Id           = entityPerson.PersonId,
                IsAuthorised = entityPerson.IsAuthorised,
                IsEnabled    = entityPerson.IsEnabled,
                IsValid      = entityPerson.IsValid,
                LastName     = entityPerson.LastName,
                Colours      = entityColours
                               .Select(c => new Models.Colour
                {
                    Id         = c.ColourId,
                    IsEnabled  = c.IsEnabled,
                    Name       = c.Name,
                    IsSelected = entityPerson.Colours.Any(x => x.ColourId == c.ColourId)
                }).OrderByDescending(x => x.Id).ToList()
            };

            return(Ok(person));
        }
        public void Register_VolunteerAlreadyExists()
        {
            Person moqPerson = new Person()
            {
                Id = 1,
                UserId = null,
                FirstName = "Cathy",
                LastName = "Jones",
                Email = "*****@*****.**",
                PhoneNumber = "555-222-9139"
            };

            List<Person> people = new List<Person>();
            people.Add(moqPerson);

            var moqDataService = new Mock<IDataService>();
            moqDataService.Setup(s => s.Persons).Returns(people.AsQueryable());

            VolunteerService service = new VolunteerService(moqDataService.Object);
            Person actual = service.Register("Cathy", "Jones", "*****@*****.**", "555-222-9139 ext 33", 6);

            Assert.AreEqual("Cathy", actual.FirstName);
            Assert.AreEqual("Jones", actual.LastName);
            Assert.AreEqual("*****@*****.**", actual.Email);
            Assert.AreEqual("555-222-9139 ext 33", actual.PhoneNumber);
        }
        /// <summary>
        /// Populates defaults and opens edit form to add new record
        /// GET: /Admin/Person/Create
        /// </summary>
        public ActionResult Create()
        {
            Breadcrumbs.Current.AddBreadcrumb(3, "Add Person");
            var record = new Models.Person();

            // any default values can be set here or in partial class Person.InitDefaults()
            return(View("PersonEdit", record));
        }
        public ActionResult Delete(Person person)
        {
            if (person != null) {
                personList.Remove(person);
            }

            return RedirectToAction("index");
        }
        public ActionResult Create(Person person)
        {
            if (person != null) {
                person.Id = Guid.NewGuid();
                personList.Add(person);
            }

            return RedirectToAction("index");
        }
Beispiel #10
0
        private void OnAddExecute()
        {
            Log.Info("Adding new person");

            var person = new Person();

            Persons.Add(person);
            SelectedPerson = person;

            _flyoutService.ShowFlyout(ExampleEnvironment.PersonFlyoutName, SelectedPerson);
        }
        public void Init()
        {
            _disaster = new Disaster {Id = 0, IsActive = true, Name = "Sharknado"};
            _cluster = new Cluster {Id = 1, Name = "Red Zone"};
            _person = new Person {Id = 2, FirstName = "John", LastName = "Doe"};

            _dataService = new Mock<IDataService>();
            _dataService.Setup(x => x.Disasters).Returns(new EnumerableQuery<Disaster>(new[] {_disaster}));
            _dataService.Setup(x => x.Clusters).Returns(new EnumerableQuery<Cluster>(new[] {_cluster}));
            _dataService.Setup(x => x.Persons).Returns(new EnumerableQuery<Person>(new[] {_person}));

            _clusterCoordinatorService = new Services.ClusterCoordinatorService(_dataService.Object);
        }
        protected ActionResult ProcessForm(Models.Person record)
        {
            try {
                Web.InfoMessage = null;
                record.UpdateFromRequest();

                if (record.Password.IsBlank())
                {
                    record.Password = Beweb.RandomPassword.Generate(8);
                }

                Validate(record);

                if (ModelState.IsValid)
                {
                    Save(record, record.IsNewRecord);

                    if (Web.Request["sendemail"] != null)
                    {
                        ProcessEmail(record);
                    }

                    Web.InfoMessage = "Person " + record.GetName() + " saved." + TempData["emailMsg"];
                }
            } catch (UserErrorException e) {
                ModelState.AddModelError("Record", e.Message);
            }

            if (!ModelState.IsValid)
            {
                // invalid so redisplay form with validation message(s)
                return(View("PersonEdit", record));
            }
            else if (Web.Request["SaveAndRefreshButton"] != null)
            {
                return(RedirectToEdit(record.ID));
            }
            else if (Web.Request["DuplicateButton"] != null)
            {
                var newRecord = new Models.Person();
                newRecord.UpdateFrom(record);
                newRecord.Save();
                Web.InfoMessage = "Copy of Person " + record.GetName() + " created. You are now editing the new copy.";
                return(RedirectToEdit(newRecord.ID));
            }
            else
            {
                return(RedirectToReturnPage());
            }
        }
 public static ApiPerson DataToApiModel(Person person)
 {
     return new ApiPerson()
     {
         Id = person.Id,
         Username = person.Username,
         Email = person.Email,
         Password = person.Password,
         FirstName = person.FirstName,
         LastName = person.LastName,
         DOB = person.DOB,
         Gender = (ApiGender)person.Gender
     };
 }
        public ActionResult Index(Person vm)
        {
            //ModelState.AddModelError(string.Empty, "Class level Error");
            //ModelState.AddModelError(string.Empty, "Class level Error 2");

            if (ModelState.IsValid)
                return Json(new { valid = ModelState.IsValid });
            else
            {
                var errorList = ModelState.ToModelStateJSON();

                return Json(new { valid = ModelState.IsValid, validationErrors = errorList });
            }
        }
 private void Save(Models.Person record, bool isNew)
 {
     // add any code to update other fields/tables here
     if (Request["pwValue"] + "" != "")
     {
         record.Password = Security.CreateSecuredPassword(Request["pwValue"]);
     }
     if (record.Password.IsBlank())
     {
         // Person MUST have a password
         record.Password = Beweb.RandomPassword.Generate(8);;
     }
     record.Save();
     PersonCache.Rebuild();
 }
        public IHttpActionResult Put(Models.Person model)
        {
            var person = _personRepository.Get(model.Id);

            if (person == null)
            {
                return(NotFound());
            }

            person.IsAuthorised = model.IsAuthorised;
            person.IsEnabled    = model.IsEnabled;
            person.Colours.Clear();
            person.Colours = _colorRepository.GetAll().Where(x => model.Colours.Any(y => y.Id == x.ColourId && y.IsSelected)).ToList();
            _personRepository.Save();

            return(StatusCode(HttpStatusCode.NoContent));
        }
Beispiel #17
0
        public async Task <ActionResult <PersonViewModel> > PostUsers(PersonViewModel viewModel)
        {
            try
            {
                if (viewModel == null)
                {
                    return(BadRequest());
                }
                else
                {
                    var person = new Models.Person()
                    {
                        EmailAddress = viewModel.EmailAddress,
                        Password     = viewModel.Password,
                        FirstName    = viewModel.FirstName,
                        LastName     = viewModel.LastName,

                        Address = viewModel.Address,
                        //Id = viewModel.Id,
                        City      = viewModel.City,
                        Countries = viewModel.Countries,
                        //InsertDateTime = DateTime.Now,
                        IsActive    = viewModel.IsActive,
                        IsAdmin     = viewModel.IsAdmin,
                        PhoneNumber = viewModel.PhoneNumber,
                        PostCode    = viewModel.PostCode,
                        Orders      = null,
                        Role        = null,
                    };



                    await UnitOfWork.PersonRepository.Insert(person);

                    //_context.People.Add(person);
                    await UnitOfWork.SaveAsync();
                }
            }
            catch (Exception)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError,
                                  "Error rerieving data from database"));
            }

            return(CreatedAtAction("GetPerson", new { id = viewModel.Id }, viewModel));
        }
        private void Validate(Models.Person record)
        {
            // add any code to check for validity
            //ModelState.AddModelError("Record", "Suchandsuch cannot be whatever.");

            if (record.Email.IsBlank())
            {
                ModelState.AddModelError("Record", "Email address cannot be blank.");
            }

            /*
             * string EmailAgain = Request["emailConfirmed"];
             * if (!EmailAgain.Equals(record.Email)) {
             *      ModelState.AddModelError("Record", "Emails do not match, please re enter.");
             * }
             */
        }
        public void Init()
        {
            _coordinatorId = 42;
            _notCoordinatorId = 10;
            _dataService = new Mock<IDataService>();

            _disaster1 = new Disaster { Id = 1, IsActive = true, Name = "Sharknado" };
            _disaster2 = new Disaster { Id = 2, IsActive = true, Name = "Ice Age" };

            _cluster1 = new Cluster { Id = 2, Name = "Red Zone" };
            _cluster2 = new Cluster { Id = 3, Name = "Other Cluster" };

            _person1 = new Person { Id = 3, FirstName = "John", LastName = "Doe" };
            _person2 = new Person { Id = 4, FirstName = "Richard", LastName = "Roe" };
            _person3 = new Person { Id = 5, FirstName = "Little", LastName = "Toe" };

            _dataService.Setup(x => x.Disasters).Returns(new EnumerableQuery<Disaster>(new[]
            {
                _disaster1,
                _disaster2
            }));
            _dataService.Setup(x => x.Clusters).Returns(new EnumerableQuery<Cluster>(new[]
            {
                _cluster1,
                _cluster2
            }));
            _dataService.Setup(x => x.Persons).Returns(new EnumerableQuery<Person>(new[]
            {
                _person1,
                _person2,
                _person3
            }));
            _dataService.Setup(x => x.Commitments).Returns(new EnumerableQuery<Commitment>(new[]
            {
                new Commitment { DisasterId = _disaster1.Id, PersonId = _person1.Id },
                new Commitment { DisasterId = _disaster1.Id, PersonId = _person2.Id },
                new Commitment { DisasterId = _disaster2.Id, PersonId = _person3.Id }
            }));
            _clusterCoordinatorService = new Services.ClusterCoordinatorService(_dataService.Object);
        }
        public void GetPersonDetailsForChangeContactInfoReturnsExpectedData()
        {
            var personOne = new Person
            {
                Id = 1,
                UserId = 6,
                FirstName = "Cathy",
                LastName = "Jones",
                Email = "*****@*****.**",
                PhoneNumber = "555-222-9139",
                ClusterId = 1
            };

            var personTwo = new Person
            {
                Id = 2,
                UserId = 7,
                FirstName = "Stan",
                LastName = "Smith",
                Email = "*****@*****.**",
                PhoneNumber = "111-333-2222"
            };

            var dataService = new Mock<IDataService>();
            var personList = new List<Person>
            {
                personOne,
                personTwo
            };
            dataService.Setup(x => x.Persons).Returns(personList.AsQueryable());
            var underTest = new VolunteerService(dataService.Object);

            var result = underTest.GetPersonDetailsForChangeContactInfo(personTwo.UserId.GetValueOrDefault());

            Assert.IsNotNull(result);
            Assert.AreEqual(personTwo.Email, result.Email);
            Assert.AreEqual(personTwo.PhoneNumber, result.PhoneNumber);
        }
        protected void ProcessEmail(Models.Person record)
        {
            var body = Request["EmailCopy"];

            body = body.Replace("[firstname]", record.FirstName);
            body = body.Replace("[username]", record.Email);
            body = body.Replace("[password]", (String.IsNullOrEmpty(Crypto.Decrypt(record.Password)) ? record.Password : Crypto.Decrypt(record.Password)));
            body = body.Replace("[baseurl]", Web.BaseUrl);

            string emailResult = SendEMail.SimpleSendHtmlEmail(record.Email, Request["EmailSubject"], formatEMailTxt(body));

            //SendEMail em = new SendEMail()
            if (emailResult == null)
            {
                TempData["emailMsg"] = " Notification Email sent to " + record.Email + ".";
                //record.AdminOnlyNotes+="\nEmail sent on "+DateTime.Now.FmtDateTime();
            }
            else
            {
                TempData["emailMsg"] = " Notification Email failed to send to " + record.Email + ".<!--[" + emailResult + "]-->";                //
                //record.AdminOnlyNotes+="\nEmail send failed on "+DateTime.Now.FmtDateTime();
            }
        }
Beispiel #22
0
        /// <summary>
        /// Http : POST
        /// </summary>
        public async Task PostPerson()
        {
            await Task.Run(async () =>
            {
                using (RESTWebClient client = new RESTWebClient())
                {
                    string postUrl = "http://localhost:8001/people";
                    Person newPerson = new Person();
                    newPerson.FirstName = string.Format("FirstName_{0}", DateTime.Now.Ticks);
                    newPerson.LastName = string.Format("LastName_{0}", DateTime.Now.Ticks);

                    //the server PersonHandler [RouteBaseAttribute] is set to return Xml, 
                    //so we need to deserialize it as Xml 
                    var response = await client.Post<Person>(postUrl, newPerson, SerializationToUse.Xml);
                    Console.WriteLine("Http : POST");
                    Console.WriteLine("Status Code : {0}", response.StatusCode);
                    Console.WriteLine(postUrl);
                    Console.WriteLine(response.Content);
                    Console.WriteLine("=================================");

                }
            });
        }
Beispiel #23
0
 public static DataTable GetProvider(int icompany, string sclient)
 {
     Person Person = new Person();
     return Person.GetProvider(icompany, sclient);
 }
        public void WhenQueryingReturnCommitmentsOnlyForThisUser()
        {
            var moqDataService = new Mock<IDataService>();
            var disaster = new Disaster
            {
                Id = 1,
                Name = "test",
                IsActive = true
            };
            moqDataService.Setup(ds => ds.Disasters)
                .Returns(new List<Disaster>
                {
                    disaster
                }.AsQueryable());

            moqDataService.Setup(ds => ds.Commitments)
                .Returns(new List<Commitment>
                {
                    new Commitment
                    {
                        DisasterId=1,
                        Id = 1,
                        PersonId=1,
                        StartDate=new DateTime(2013, 8, 1),
                        EndDate = new DateTime(2013, 9, 1),
                        Disaster=disaster
                    },
                    new Commitment
                    {
                        DisasterId=1,
                        Id = 2,
                        PersonId=2,
                        StartDate=new DateTime(2013, 8, 1),
                        EndDate = new DateTime(2013, 9, 1)
                    }
                }.AsQueryable());
            var underTest = new VolunteerService(moqDataService.Object);

            var person = new Person
            {
                Id = 1,
                FirstName = "test",
                LastName = "tester"
            };
            var results = underTest.RetrieveCommitmentsForDisaster(person, disaster);
            Assert.IsTrue(results.Count() == 1);
        }
Beispiel #25
0
 public static DataTable GetSolicitante(int icompany, string sclient)
 {
     Person Person = new Person();
     return Person.GetSolicitante(icompany, sclient);
 }
        public static Models.Person MapFrom(this External.LoanObject loanObject, PersonFieldList fields, Models.Person person = null)
        {
            bool changed = false;

            changed = changed || loanObject.ContainsValues(fields.FirstName, fields.LastName, fields.DateOfBirth);


            if (changed)
            {
                if (person == null)
                {
                    person = new Person();
                }

                MappingUtil.SetValue(loanObject, fields.FirstName, (val) => person.FirstName     = val, person.FirstName);
                MappingUtil.SetValue(loanObject, fields.LastName, (val) => person.LastName       = val, person.LastName);
                MappingUtil.SetValue(loanObject, fields.DateOfBirth, (val) => person.DateOfBirth = val, person.DateOfBirth);
            }

            return(person);
        }
Beispiel #27
0
 public static DataTable GetfiscalAddresFromPersonNumber(int iperson, int itypeperson)
 {
     Person Person = new Person();
     return Person.GetfiscalAddresFromPersonNumber(iperson, itypeperson);
 }
        public void UpdateDetails_PersonNotFound()
        {
            Person moqPerson = new Person()
            {
                Id = 1,
                UserId = null,
                FirstName = "Cathy",
                LastName = "Jones",
                Email = "*****@*****.**",
                PhoneNumber = "555-222-9139"
            };

            List<Person> people = new List<Person>();
            people.Add(moqPerson);

            var moqDataService = new Mock<IDataService>();
            moqDataService.Setup(s => s.Persons).Returns(people.AsQueryable());
            VolunteerService service = new VolunteerService(moqDataService.Object);

            service.UpdateDetails(new Person()
            {
                Id = 25,
                Email = "*****@*****.**"
            });
        }
        public void UpdateDetails_PersonEmailAlreadyInUse()
        {
            Person moqPersonOne = new Person()
            {
                Id = 1,
                UserId = null,
                FirstName = "Cathy",
                LastName = "Jones",
                Email = "*****@*****.**",
                PhoneNumber = "555-222-9139"
            };

            Person moqPersonTwo = new Person()
            {
                Id = 2,
                UserId = null,
                FirstName = "Stan",
                LastName = "Smith",
                Email = "*****@*****.**",
                PhoneNumber = "111-333-2222"
            };

            List<Person> people = new List<Person>();
            people.Add(moqPersonOne);
            people.Add(moqPersonTwo);

            var moqDataService = new Mock<IDataService>();
            moqDataService.Setup(s => s.Persons).Returns(people.AsQueryable());

            VolunteerService service = new VolunteerService(moqDataService.Object);
            // Try to change Cathy Jones' email to Stan Smith's email...
            service.UpdateDetails(new Person()
            {
                Id = 1,
                Email = "*****@*****.**",
                FirstName = "Cathy",
                LastName = "Jones"
            });
        }
Beispiel #30
0
 public static DataTable GetPersonsForType(int icompany, string sclient, string spersontype)
 {
     Person Person = new Person();
     return Person.GetPersonsForType(icompany, sclient, spersontype);
 }
        public void UpdateDetails_ChangeEmailToUnusuedEmail_DoesNotThrowPersonEmailAlreadyInUseException()
        {
            Person moqPersonOne = new Person()
            {
                Id = 1,
                UserId = null,
                FirstName = "Cathy",
                LastName = "Jones",
                Email = "*****@*****.**",
                PhoneNumber = "555-222-9139"
            };

            List<Person> people = new List<Person>();
            people.Add(moqPersonOne);

            var moqDataService = new Mock<IDataService>();
            moqDataService.Setup(s => s.Persons).Returns(people.AsQueryable());

            VolunteerService service = new VolunteerService(moqDataService.Object);
            // Try to change Cathy Jones' email to something not in use...
            service.UpdateDetails(new Person()
            {
                Id = 1,
                Email = "*****@*****.**",
                FirstName = "Cathy",
                LastName = "Jones"
            });
        }
 public static void MapTo(this Models.Person person, External.LoanObject loanObject, PersonFieldList fields)
 {
     loanObject.MapValue(fields.FirstName, person.FirstName);
     loanObject.MapValue(fields.LastName, person.LastName);
     loanObject.MapValue(fields.DateOfBirth, person.DateOfBirth);
 }
Beispiel #33
0
 public static DataTable GetDataFromPersonNumber(int icompany, int iperson)
 {
     Person Person = new Person();
     return Person.GetDataFromPersonNumber(icompany, iperson);
 }
        public void UpdateDetails_Valid()
        {
            Person moqPerson = new Person()
            {
                Id = 1,
                UserId = null,
                FirstName = "Cathy",
                LastName = "Jones",
                Email = "*****@*****.**",
                PhoneNumber = "555-222-9139",
                ClusterId = 1
            };

            List<Person> people = new List<Person>();
            people.Add(moqPerson);

            var moqDataService = new Mock<IDataService>();
            moqDataService.Setup(s => s.Persons).Returns(people.AsQueryable());
            moqDataService.Setup(s => s.UpdatePerson(It.IsAny<Person>())).Returns(new Person() {
                Id = 1,
                Email = "*****@*****.**",
                FirstName = "Cathy",
                LastName = "CHANGED",
                PhoneNumber = "555-222-9139",
                ClusterId = 1
            });

            VolunteerService service = new VolunteerService(moqDataService.Object);
            var actual = service.UpdateDetails(new Person()
            {
                Id = 1, Email = "*****@*****.**", FirstName = "Cathy", LastName = "CHANGED", PhoneNumber = "555-222-9139", ClusterId = 1
            });

            // Only Last Name has been updated
            Assert.AreEqual("CHANGED", actual.LastName);

            Assert.AreEqual("Cathy", actual.FirstName);
        }
Beispiel #35
0
 public static DataTable GetAddresFromPersonNumber(int person)
 {
     Person Person = new Person();
     return Person.GetAddresFromPersonNumber(person);
 }
        public void WhenDisasterIsNullGetCommitmentsThrowsNullArgumentException()
        {
            var moqDataService = new Mock<IDataService>();
            var underTest = new VolunteerService(moqDataService.Object);

            var person = new Person
            {
                Id = 1,
                FirstName = "test",
                LastName = "tester"
            };

            var results = underTest.RetrieveCommitmentsForDisaster(person, default(Disaster));
        }
Beispiel #37
0
 public static DataTable GetPhisicPersonData(int icompany, int iperson, string stypeperson)
 {
     Person Person = new Person();
     return Person.GetPhisicPersonData(icompany, iperson, stypeperson);
 }
        public void WhenNoCommitmentsExistEmptyCollectionIsReturned()
        {
            var moqDataService = new Mock<IDataService>();
            moqDataService.Setup(ds => ds.Commitments)
                .Returns(new List<Commitment>().AsQueryable());
            var underTest = new VolunteerService(moqDataService.Object);

            var person = new Person
            {
                Id = 1,
                FirstName = "test",
                LastName = "tester"
            };
            var disaster = new Disaster
            {
                Id = 1,
                Name = "test",
                IsActive = true
            };
            moqDataService.Setup(ds => ds.Disasters)
                .Returns(new List<Disaster>
                {
                    disaster
                }.AsQueryable());

            var results = underTest.RetrieveCommitmentsForDisaster(person, disaster);
            Assert.IsTrue(results.Count() == 0);
        }
        public void UpdateDetails_DoesNotClearFirstOrLastNameIfBlank()
        {
            var moqPersonOne = new Person
            {
                Id = 1,
                UserId = 6,
                FirstName = "Cathy",
                LastName = "Jones",
                Email = "*****@*****.**",
                PhoneNumber = "555-222-9139"
            };

            var people = new List<Person> {moqPersonOne};

            var moqDataService = new Mock<IDataService>();
            moqDataService.Setup(s => s.Persons).Returns(people.AsQueryable());
            moqDataService.Setup(s => s.UpdatePerson(It.IsAny<Person>())).Returns((Person p) => p);

            var service = new VolunteerService(moqDataService.Object);

            Person actual = service.UpdateDetails(new Person
            {
                Id = 1,
                UserId = 6,
                FirstName = null,
                LastName = null,
                Email = "*****@*****.**",
                PhoneNumber = "555-222-9139"
            });

            Assert.IsNotNull(actual);
            Assert.IsFalse(string.IsNullOrEmpty(actual.FirstName), "Expected First Name not to be null or empty.");
            Assert.IsFalse(string.IsNullOrEmpty(actual.LastName), "Expected Last Name not to be null or empty.");
        }
        public void Register_EmailAlreadyInUse_ReturnTrue()
        {
            Person moqPerson = new Person()
            {
                Id = 1,
                Email = "*****@*****.**"
            };

            List<Person> people = new List<Person>();
            people.Add(moqPerson);

            var moqDataService = new Mock<IDataService>();
            moqDataService.Setup(s => s.Persons).Returns(people.AsQueryable());
            VolunteerService service = new VolunteerService(moqDataService.Object);
            Assert.IsTrue(service.EmailAlreadyInUse("*****@*****.**"));
        }