예제 #1
0
        public void OverfillingGasTankError()
        {
            //Arrange
            TestableAutomobile myTruck = new TestableAutomobile(25, "red", 13, 2013, "Ram");


            //Assert
            var exception = Assert.Throws <InvalidOperationException>(() => myTruck.Fill(50));
        }
        //--------------------------------------------------------------------------------------------------------------

        /// <summary>
        /// Compares two Automobile objects. Used for sorting lists
        /// </summary>
        /// <param name="other">the object you want to compare to</param>
        /// <returns></returns>
        ///

        // CompareTo() method returns 0 if two objects have the same value.
        // It returns a positive integer if the object passed in should be ordered after, a negative integer if it should be placed before
        public int CompareTo(TestableAutomobile other)
        {
            int result = this.Model.CompareTo(other.Model);

            if (result == 0)
            {
                result = this.Color.CompareTo(other.Color);
            }


            return(result);
        }