public void test_Measurement_Measurement_is_created_with_given_valid_length_weight_and_date()
        {
		    Measurement measurement = new Measurement(NORMAL_LENGTH, NORMAL_WEIGHT, NORMAL_DATE);
		
		    Assert.AreEqual(NORMAL_LENGTH, measurement.length);
            Assert.AreEqual(NORMAL_WEIGHT, measurement.weight);
            Assert.AreEqual(NORMAL_DATE, measurement.date);
	    }
Exemplo n.º 2
0
 public Person(String socialSecurityNumber, DateTime birthDate, PersonDef.Gender gender, Measurement firstMeasurement)
 {
     _measurements = new List<Measurement>();
     this.socialSecurityNumber = socialSecurityNumber;
     _birthDate = birthDate;
     _gender = gender;
     addMeasurement(firstMeasurement);
 }
        public void setUp()
        {
            _measurement = new Measurement(NORMAL_LENGTH, NORMAL_WEIGHT, NORMAL_DATE);
            _sameMeasurement = new Measurement(NORMAL_LENGTH, NORMAL_WEIGHT, NORMAL_DATE);
            otherDate = otherDate.AddMonths(DateTime.Now.Month);
            _otherMeasurement = new Measurement(NORMAL_LENGTH, NORMAL_WEIGHT, otherDate);
 
        }
 public void GivenAValidMeasurementObjectIsGenerated(int weight , int length, String date)
 {
     _length = length;
     _weight = weight;
     
     _date =  DateTime.Parse(date);
     
     _measurement = new Measurement(_length, _weight, _date);
 }
	    public void test_Measurement_Measurement_is_created_if_new_length_equals_25_cm()
        {
		    Measurement measurement = new Measurement(JUST_BIG_ENOUGH_LENGTH, NORMAL_WEIGHT, NORMAL_DATE);	
		
		    Assert.AreEqual(JUST_BIG_ENOUGH_LENGTH, measurement.length);
	    }
	    public void test_Measurement_Weight_is_replaced_if_new_weight_equals_300_gr()
        {
		    Measurement measurement = new Measurement(NORMAL_LENGTH, JUST_BIG_ENOUGH_WEIGHT, NORMAL_DATE);

		    Assert.AreEqual(JUST_BIG_ENOUGH_WEIGHT, measurement.weight);
	    }
        public void ThenTheMeasurementObjectShouldContainTheEnterdData()
        {
            Measurement measurement = new Measurement(_length, _weight, _date);

            Assert.AreEqual(_length, measurement.length);
            Assert.AreEqual(_weight, measurement.weight);
            Assert.AreEqual(_date, measurement.date);
        }
Exemplo n.º 8
0
        public void addMeasurement(Measurement measurement)
        {
            if (measurement == null)
            {
                throw new ArgumentException("Measurement cannot be null");
            }

            _isMeasurementsSorted = false;

            _measurements.Add(measurement);
        }
Exemplo n.º 9
0
        public void removeMeasurement(Measurement measurement) 
		{
            if (measurement == null)
            {
                throw new ArgumentException("Measurement cannot be null");
            }

            if (_measurements.Exists(e => e.date.Equals(measurement.date)))
            {
                _measurements.Remove(_measurements.Find(e => e.date.Equals(measurement.date)));
            }
            else
            {
                throw new ArgumentException("Measurement with the targeted date doesn't exist");   
            }

		}
Exemplo n.º 10
0
        public String CreateObjectWithError()
        {
            try
            {
                _measurement = new Measurement(_length, _weight, _date);

                return "No";
            }
            catch (ArgumentException)
            {

                return "Yes";
            }
        }
Exemplo n.º 11
0
        public String CreateObject()
        {
            _measurement = new Measurement(_length, _weight, _date);

            if (_measurement.length != _length)
            {
                return "No";
            }

            if (_measurement.weight != _weight)
            {
                return "No";
            }

            if (_measurement.date != _date)
            {
                return "No";
            }

            return "Yes";
        }