Exemple #1
0
 public Vowel(VowelArticulatoryDimensions articulatoryDimension, VowelBacknesses backness, VowelHeights height, VowelTensenesses tenseness)
 {
     this.ArticulatoryDimension = articulatoryDimension;
     this.Backness  = backness;
     this.Height    = height;
     this.Tenseness = tenseness;
 }
        public void GetHashCode_other_all_members_are_same_returns_same_code()
        {
            VowelArticulatoryDimensions articulatoryDimension = VowelArticulatoryDimensions.Front;
            VowelBacknesses             backness = VowelBacknesses.Front;
            VowelHeights     height    = VowelHeights.Close;
            VowelTensenesses tenseness = VowelTensenesses.Tense;

            Vowel other    = new Vowel(articulatoryDimension: articulatoryDimension, backness: backness, height: height, tenseness: tenseness);
            Vowel instance = new Vowel(articulatoryDimension: articulatoryDimension, backness: backness, height: height, tenseness: tenseness);

            Assert.NotSame(other, instance);

            var expected = other.GetHashCode();
            var actual   = instance.GetHashCode();

            Assert.Equal(expected, actual);
        }
        public void Equals_other_all_members_are_same_returns_true()
        {
            VowelArticulatoryDimensions articulatoryDimension = VowelArticulatoryDimensions.Front;
            VowelBacknesses             backness = VowelBacknesses.Front;
            VowelHeights     height    = VowelHeights.Close;
            VowelTensenesses tenseness = VowelTensenesses.Tense;

            Vowel other    = new Vowel(articulatoryDimension: articulatoryDimension, backness: backness, height: height, tenseness: tenseness);
            Vowel instance = new Vowel(articulatoryDimension: articulatoryDimension, backness: backness, height: height, tenseness: tenseness);

            Assert.NotSame(other, instance);

            bool expected = true;
            bool actual   = instance.Equals(other);

            Assert.Equal(expected, actual);
        }
        public void Equals_other_Height_is_different_returns_false()
        {
            VowelArticulatoryDimensions articulatoryDimension = VowelArticulatoryDimensions.Front;
            VowelBacknesses             backness = VowelBacknesses.Front;
            VowelHeights     height1             = VowelHeights.Close;
            VowelHeights     height2             = VowelHeights.CloseMid;
            VowelTensenesses tenseness           = VowelTensenesses.Tense;

            Vowel other    = new Vowel(articulatoryDimension: articulatoryDimension, backness: backness, height: height2, tenseness: tenseness);
            Vowel instance = new Vowel(articulatoryDimension: articulatoryDimension, backness: backness, height: height1, tenseness: tenseness);

            Assert.NotEqual(other.Height, instance.Height);

            bool expected = false;
            bool actual   = instance.Equals(other);

            Assert.Equal(expected, actual);
        }