Exemple #1
0
        /// <summary>
        /// Returns true if Car instances are equal
        /// </summary>
        /// <param name="other">Instance of Car to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Car other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     LicensePlate == other.LicensePlate ||
                     LicensePlate != null &&
                     LicensePlate.Equals(other.LicensePlate)
                     ) &&
                 (
                     Model == other.Model ||
                     Model != null &&
                     Model.Equals(other.Model)
                 ) &&
                 (
                     Type == other.Type ||
                     Type != null &&
                     Type.Equals(other.Type)
                 ));
        }
Exemple #2
0
        private bool ValidateInput()
        {
            if (String.IsNullOrEmpty(Brand) || String.IsNullOrEmpty(ModelName) || String.IsNullOrEmpty(ModelYear) || String.IsNullOrEmpty(Color) || String.IsNullOrEmpty(FirstName) || String.IsNullOrEmpty(LastName) || String.IsNullOrEmpty(ICNumber) || String.IsNullOrEmpty(Phone) || String.IsNullOrEmpty(Email))
            {
                MessageBox.Show("Rejected request!\nThere are empty fields!", "Error!", MessageBoxButton.OK, MessageBoxImage.Information);
                return(false);
            }

            if (ParseToInt(ModelYear) > DateTime.Now.Year || ParseToInt(ModelYear) < 1900)
            {
                MessageBox.Show("Rejected request!\nThere was an error with the Model Date!", "Error!", MessageBoxButton.OK, MessageBoxImage.Information);
                return(false);
            }


            if (isNumeric(Phone) || ICNumber.Length < 10 || ICNumber.Length > 15)
            {
                MessageBox.Show("Rejected request!\nThere was an error with the Phone Number!", "Error!", MessageBoxButton.OK, MessageBoxImage.Information);
                return(false);
            }

            if (isNumeric(ICNumber) || ICNumber.Length != 13)
            {
                MessageBox.Show("Rejected request!\nThere was an error with the Identity Card Number!", "Error!", MessageBoxButton.OK, MessageBoxImage.Information);
                return(false);
            }

            if (LicensePlate.Length > 11 || LicensePlate.Length < 8 || !LicensePlate.Equals(LicensePlate.ToUpper()))
            {
                MessageBox.Show("Rejected request!\nThere was an error with the License Plate input!", "Error!", MessageBoxButton.OK, MessageBoxImage.Information);
                return(false);
            }
            return(true);
        }
Exemple #3
0
        /// <summary>
        /// Returns true if DiagnosticProfile instances are equal
        /// </summary>
        /// <param name="other">Instance of DiagnosticProfile to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(DiagnosticProfile other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     LicensePlate == other.LicensePlate ||
                     LicensePlate != null &&
                     LicensePlate.Equals(other.LicensePlate)
                     ) &&
                 (
                     Engine == other.Engine ||
                     Engine != null &&
                     Engine.Equals(other.Engine)
                 ) &&
                 (
                     Body == other.Body ||
                     Body != null &&
                     Body.Equals(other.Body)
                 ) &&
                 (
                     LowVoltage == other.LowVoltage ||
                     LowVoltage != null &&
                     LowVoltage.Equals(other.LowVoltage)
                 ) &&
                 (
                     Lighting == other.Lighting ||
                     Lighting != null &&
                     Lighting.Equals(other.Lighting)
                 ) &&
                 (
                     Brakes == other.Brakes ||
                     Brakes != null &&
                     Brakes.Equals(other.Brakes)
                 ) &&
                 (
                     Sensors == other.Sensors ||
                     Sensors != null &&
                     Sensors.Equals(other.Sensors)
                 ) &&
                 (
                     Miscellaneous == other.Miscellaneous ||
                     Miscellaneous != null &&
                     Miscellaneous.SequenceEqual(other.Miscellaneous)
                 ) &&
                 (
                     Conditioning == other.Conditioning ||
                     Conditioning != null &&
                     Conditioning.Equals(other.Conditioning)
                 ));
        }
Exemple #4
0
        public void TestEqualsString()
        {
            using (StringWriter sw = new StringWriter())
            {
                LicensePlate li1 = new LicensePlate("FI", "ABC-123");

                // Assert
                Assert.AreEqual(false, li1.Equals("heh"), "LicencePlate should not equal to a string!");
            }
        }
Exemple #5
0
        public void TestEqualsSamePlateSameObject()
        {
            using (StringWriter sw = new StringWriter())
            {
                LicensePlate li1 = new LicensePlate("FI", "ABC-123");
                LicensePlate li2 = new LicensePlate("FI", "ABC-123");

                // Assert
                Assert.AreEqual(true, li1.Equals(li2), "LicencePlate should not equal to a string!");
            }
        }
Exemple #6
0
        /// <summary>
        /// Returns true if InlineResponse200 instances are equal
        /// </summary>
        /// <param name="other">Instance of InlineResponse200 to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(InlineResponse200 other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     LicensePlate == other.LicensePlate ||
                     LicensePlate != null &&
                     LicensePlate.Equals(other.LicensePlate)
                     ) &&
                 (
                     Visit == other.Visit ||
                     Visit != null &&
                     Visit.Equals(other.Visit)
                 ));
        }
Exemple #7
0
 public override bool Equals(object obj)
 {
     return(obj != null && LicensePlate.Equals(((Car)obj).LicensePlate));
 }