コード例 #1
0
 public void Measurement_is_created_with_given_valid_length_weight_and_date()
 {
     Measurement measurement = new Measurement(NORMAL_LENGTH, NORMAL_WEIGHT, NORMAL_DATE);
     
     specify = () => measurement.length.should_be(NORMAL_LENGTH);
     specify = () => measurement.weight.should_be(NORMAL_WEIGHT);
     specify = () => measurement.date.should_be(NORMAL_DATE);
 }
コード例 #2
0
        public void GivenAnotherExistingMeasurementWithTheSameLengthTheSameWeightAndAnotherDate(int length, int weight, string date)
        {
            _length = length;
            _weight = weight;
            _date = DateTime.Parse(date);

            _measurement = new Measurement(_length, _weight, _date);
        }
コード例 #3
0
 public void ThenTheNewMeasurementIsAddedToMyBMIHistory()
 {
     Measurement m1 = new Measurement(_length, _weight, _date);
     Measurement m2 = _person.measurements.First(e => e.length == _length && e.weight == _weight && e.date == _date);
     
     Assert.AreEqual(m1.length, m2.length);
     Assert.AreEqual(m1.weight, m2.weight);
     Assert.AreEqual(m1.date, m2.date);
 }
コード例 #4
0
 public void resetParameters()
 {
     _measurement = null;
     _otherMeasurement = null;
     _length = 0;
     _weight = 0;
     _date = new DateTime();
     _ex = null;
     _result = null;
 }
コード例 #5
0
        public void WhenIWantToMakeANewMeasurementWithLengthWeightAndDate(int length, int weight, string date)
        {
            _length = length;
            _weight = weight;
            _date = DateTime.Parse(date);

            try
            {
                _measurement = new Measurement(_length, _weight, _date);
            }
            catch (Exception ex)
            {
                _ex = ex;
            }
        }
コード例 #6
0
        public Person(String socialSecurityNumber, DateTime birthDate, PersonDef.Gender gender, Measurement firstMeasurement)
        {
            if (socialSecurityNumber == null)
            {
                throw new ArgumentException("Invalid social security number");   
            }

            if (firstMeasurement == null)
            {
                throw new ArgumentException("Invalid first measurement");
            }

            _measurements = new List<Measurement>();
            this.socialSecurityNumber = socialSecurityNumber;
            _birthDate = birthDate;
            _gender = gender;
            addMeasurement(firstMeasurement);
            _isChanged = true;
        }
コード例 #7
0
 private void IWantToMakeANewMeasurementWithValidLengthAndInvalidWeight()
 {
     try
     {
         _measurement = new Measurement(ValidLength, InvalidWeight);
     }
     catch (Exception ex)
     {
         _ex = ex;
     }
 }
コード例 #8
0
 private void IWantToMakeANewMeasurementWithLengthAndWeightAndDate()
 {
     try
     {
         _measurement = new Measurement(LengthVal, WeightVal, DateTime.Parse(DateVal));
     }
     catch (Exception ex)
     {
         _ex = ex;
     }
 }
コード例 #9
0
 private void IWantToMakeANewMeasurementWithLengthAndWeight()
 {
     try
     {
         _measurement = new Measurement(LengthVal, WeightVal);
     }
     catch (Exception ex)
     {
         _ex = ex;
     }
 }
コード例 #10
0
        public void WhenIWantToMakeANewMeasurementWithLengthWeightAndTheCurrentDate(int length, int weight)
        {
            _length = length;
            _weight = weight;
            _date = DateTime.Now;

            try
            {
                _measurement = new Measurement(_length, _weight, _date);
            }
            catch (Exception ex)
            {
                _ex = ex;
            }
        }
コード例 #11
0
 private void anExistingMeasurementWithDate(string date)
 {
     _measurement = new Measurement(_LENGTH, _WEIGHT, DateTime.Parse(date));
 }
コード例 #12
0
 private void anotherExistingMeasurementWithAnotherLengthAndWeightAndTheSameDate(int length, int weight, String date)
 {
     _otherMeasurement = new Measurement(length, weight, DateTime.Parse(date));
 }
コード例 #13
0
 public void GivenAValidMeasurementObjectIsGeneratedWithDate(String date)
 {
     _date = DateTime.Parse(date);
     _measurement = new Measurement(NORMAL_LENGTH, NORMAL_WEIGHT, _date);
 }
コード例 #14
0
 public void GivenAValidMeasurementObject()
 {
     _measurement = new Measurement(NORMAL_LENGTH, NORMAL_WEIGHT, NORMAL_DATE);
 }
コード例 #15
0
 public void WhenITryToCreateANewMeasurement()
 {
     try
     {
         _measurement = new Measurement(_length, _weight, _date);
     }
     catch (Exception ex)
     {
         _ex = ex;
     }
     
 }
コード例 #16
0
 public void WhenITryToCreateANewMeasurementObjectWithNormalLength(String circumstance)
 {
     try
     {
         _measurement = new Measurement(_length, _weight, _date);
     }
     catch (Exception ex)
     {
         _ex = ex;
     }
 }
コード例 #17
0
 public void GivenAnotherExistingMeasurementWithDate(string date)
 {
     _date = DateTime.Parse(date);
     _otherMeasurement = new Measurement(_LENGTH, _WEIGHT, _date);
 }
コード例 #18
0
 void before_op()
 {
     _measurement = new Measurement(NORMAL_LENGTH, NORMAL_WEIGHT, NORMAL_DATE);
 }
コード例 #19
0
 private void IWantToMakeANewMeasurementWithValidLengthAndValidWeightAndInValidDate()
 {
     try
     {
         _measurement = new Measurement(ValidLength, ValidWeight, DateTime.Parse(InvalidDate));
     }
     catch (Exception ex)
     {
         _ex = ex;
     }
 }
コード例 #20
0
 private void anExistingMeasurement()
 {
     _measurement = new Measurement(_LENGTH, _WEIGHT, _DATE);
 }
コード例 #21
0
 public void GivenAnotherMeasurementObjectIsCreatedWithTheDateWhichIsAnEarlierDate(String date, String circumstance)
 {
     _otherMeasurement = new Measurement(NORMAL_LENGTH,NORMAL_WEIGHT, DateTime.Parse(date));
 }
コード例 #22
0
 private void anExistingMeasurementWithLengthAndWeightAndDate(int length, int weight, String date)
 {
     _measurement = new Measurement(length, weight, DateTime.Parse(date));
 }
コード例 #23
0
 public void GivenAValidUserWhichHasAValidMeasurement()
 {
     _measurementBuf = new Measurement(180, 75000, DateTime.Now);
     _person = new Person("1", new DateTime(1986, 5, 2), PersonDef.Gender.Male, _measurementBuf);
 }
コード例 #24
0
        public void addMeasurement(Measurement measurement)
        {
            if (measurement == null)
            {
                throw new ArgumentException("Measurement cannot be null");
            }

            if (_measurements.Exists(e => e.date.Day == measurement.date.Day && 
                                          e.date.Month == measurement.date.Month &&
                                          e.date.Year == measurement.date.Year))
            {
                throw new ArgumentException("A measurement for this moment is already registered");   
            }

            _isMeasurementsSorted = false;

            _measurements.Add(measurement);
            _isChanged = true;
        }
コード例 #25
0
 public void GivenAnExistingMeasurement()
 {
     _measurement = new Measurement(_LENGTH, _WEIGHT, _DATE);
 }
コード例 #26
0
 public void GivenAnotherMeasurementObjectIsCreatedWhichIsNull()
 {
     _otherMeasurement = null;
 }
コード例 #27
0
 public void GivenAnInvalidFirstMeasurementIsProvided()
 {
     _measurement = null;
 }
コード例 #28
0
 public void WhenITryToFetchTheMostRecentMeasurement()
 {
     _measurement = _person.getLastMeasurement();
 }
コード例 #29
0
 public void GivenAValidStartingMeasurementIsProvided()
 {
     _measurement = new Measurement(180, 60000, DateTime.Now);
 }