public void resetParameters()
 {
     _person = null;
     _length = 0;
     _weight = 0;
     _date = new DateTime();
     _ex = null;   
 }
        public void WhenITryToAddTheNewMeasurement()
        {
            _person = ScenarioContext.Current.Get<Person>("User");

            try
            {
                _person.addMeasurement(new Measurement(_length, _weight, _date));
            }
            catch (Exception ex)
            {
                ScenarioContext.Current.Add("Error", ex);
            }
        }
 public void GivenAValidUserWhichHasAValidMeasurement()
 {
     _measurementBuf = new Measurement(180, 75000, DateTime.Now);
     _person = new Person("1", new DateTime(1986, 5, 2), PersonDef.Gender.Male, _measurementBuf);
 }
 private void anExistingPerson()
 {
     _person = new Person(_SOCSECNR, _BIRTHDATE, _GENDER, new Measurement(_LENGTH, _WEIGHT, _DATE));
 }
Esempio n. 5
0
        public Boolean equals(Person person)
        {
           
            if (person != null && _socialSecurityNumber == person.socialSecurityNumber)
            {
                return true;
            }

            return false;
        }
 public void resetParameters()
 {
     _person = null;
     _BMI = 0;  
 }
 private void GivenAnExistingPerson()
 {
     _person = new Person("10", DateTime.Now,PersonDef.Gender.Male, new BMI.Containers.Measurement(180,60000,DateTime.Now));
 }
        public void WhenITryToChangeThePersonalDataOfTheUser()
        {
            _person = ScenarioContext.Current.Get<Person>("User");

            try
            {
                _person.birthDate = _birthDate;
                _person.gender = _gender;
                _person.socialSecurityNumber = _socialSecNumber;
            }
            catch (Exception ex)
            {
                ScenarioContext.Current.Add("Error", ex);
            }
        }
 public void WhenITryToGenerateANewUser()
 {
     try
     {
         _person = new Person(_socialSecNumber, _birthDate, _gender, _measurement);
     }
     catch (Exception ex)
     {
         ScenarioContext.Current.Add("Error", ex);
     }
 }
        public ActionResult NewPerson(PersonWrapper data)
        {
            ViewBag.Title = "New Person";
            
            try
            {
                if (data != null)
                {
                    if (ModelState.IsValid)
                    {
                        Measurement firstMeasurement = new Measurement(int.Parse(data.length), int.Parse(data.weight), data.date);
                        Person newPerson = new Person(data.socialSecurityNumber, data.birthDate, data.gender,
                            firstMeasurement);

                        _dal.addPerson(newPerson);

                        ViewBag.Message = "New person with social security number " + data.socialSecurityNumber +
                                          " added";
                    }
                    else
                    {
                        ViewBag.Title = "Error";    
                    }
                    
                    return View(data);   
                }

                ViewBag.Message = "Data error:No data was passed to the server. Data was 'null'";
            }
            catch (Exception ex)
            {
                ViewBag.Title = "Error";
                ViewBag.Message = ex.Message;
            }

            return View(data); 
        }
 public void GivenAValidPersonIsAddedWithSocialSecurityNumber(String value)
 {
     _person = new Person(value, BIRTHDATE, PersonDef.Gender.Male, new Measurement(NORMAL_LENGTH, NORMAL_WEIGHT, DATE));   
 }
 public void GivenAPersonWhichIsNull()
 {
     _person = null;
 }
 public void GivenAValidPersonIsProvided()
 {
     _person = new Person("10", BIRTHDATE, PersonDef.Gender.Male, new Measurement(NORMAL_LENGTH,NORMAL_WEIGHT,DATE));   
 }
 public void GivenAnExistingPerson()
 {
     _person = new Person(_SOCSECNR, _BIRTHDATE, _GENDER, new Measurement(_LENGTH, _WEIGHT, _DATE));
 }
        public void loadPersonData(Person data)
        {
            _socialSecurityNumber = data.socialSecurityNumber;
            _birthDate = data.birthDate;
            _gender = data.gender;

            _length = data.getLength().ToString(CultureInfo.InvariantCulture);
            _weight = data.getWeight().ToString(CultureInfo.InvariantCulture);
            _date = data.getLastMeasurementDate();

            _bmi = data.getBMI();
        }