Esempio n. 1
0
        public void RestaurantSignature_Equals()
        {
            // Create two different signatures using the same parameters
            RestaurantSignature S1 = new RestaurantSignature("A", 3);
            RestaurantSignature S2 = new RestaurantSignature("A", 3);

            // Based on how equals method is defined, true should be returned:
            Assert.IsTrue(S1.Equals(S2));

            // Create another signature with the same rating, but different name
            RestaurantSignature S3 = new RestaurantSignature("B", 3);

            // Based on how equals method is defined, false should be returned:
            // Since A is not the same as B
            Assert.IsFalse(S2.Equals(S3));

            // Create another signature with the same name, but different rating
            RestaurantSignature S4 = new RestaurantSignature("A", 4);

            // Based on how equals method is defined, false should be returned:
            // Since 3!= 4
            Assert.IsFalse(S2.Equals(S4));

            // Create another signature with different name and rating
            RestaurantSignature S5 = new RestaurantSignature("C", 1);

            // Based on how equals method is defined, false should be returned:
            // Since 3!= 4
            Assert.IsFalse(S2.Equals(S5));
        }