Exemplo n.º 1
0
        public void When_other_NoteChoice_is_null_they_are_not_equal()
        {
            // arrange
            var noteChoice = new NoteChoice(new HashSet <VoiceNoteChoice>());

            // act
            var areEqual       = noteChoice.Equals(null);
            var areObjectEqual = noteChoice.Equals((object)null);

            // assert
            areEqual.Should().BeFalse();
            areObjectEqual.Should().BeFalse();
        }
Exemplo n.º 2
0
        public void When_other_NoteChoice_is_same_reference_they_are_equal()
        {
            // arrange
            var noteChoice  = new NoteChoice(new HashSet <VoiceNoteChoice>());
            var noteChoiceB = noteChoice;

            // act
            var areEqual       = noteChoice.Equals(noteChoiceB);
            var areObjectEqual = noteChoice.Equals((object)noteChoiceB);

            // assert
            areEqual.Should().BeTrue();
            areObjectEqual.Should().BeTrue();
        }
Exemplo n.º 3
0
        public void When_note_choices_have_different_voice_note_choices_they_are_not_equal()
        {
            // arrange
            var voiceNoteChoicesA = new HashSet <VoiceNoteChoice>
            {
                new(Voice.Bass, NoteMotion.Oblique, 2),
                new(Voice.Harmony, NoteMotion.Descending, 13),
                new(Voice.Melody, NoteMotion.Ascending, 124)
            };

            var voiceNoteChoicesB = new HashSet <VoiceNoteChoice>
            {
                new(Voice.Bass, NoteMotion.Oblique, 1),
                new(Voice.Harmony, NoteMotion.Descending, 12),
                new(Voice.Melody, NoteMotion.Ascending, 123)
            };

            var noteChoiceA = new NoteChoice(voiceNoteChoicesA);
            var noteChoiceB = new NoteChoice(voiceNoteChoicesB);

            // act
            var areEqual            = noteChoiceA.Equals(noteChoiceB);
            var areEqualOperator    = noteChoiceA == noteChoiceB;
            var areNotEqualOperator = noteChoiceA != noteChoiceB;
            var areHashCodesEqual   = noteChoiceA.GetHashCode() == noteChoiceB.GetHashCode();

            // assert
            areEqual.Should().BeFalse();
            areEqualOperator.Should().BeFalse();
            areNotEqualOperator.Should().BeTrue();
            areHashCodesEqual.Should().BeFalse();
        }
Exemplo n.º 4
0
        public void When_other_NoteChoice_is_not_a_NoteChoice_they_are_not_equal()
        {
            // arrange
            var voiceNoteChoices = new HashSet <VoiceNoteChoice>();

            var noteChoice  = new NoteChoice(voiceNoteChoices);
            var noteChoiceB = new { SomeField = 1 };

            // act
            var areEqual = noteChoice.Equals(noteChoiceB);

            // assert
            areEqual.Should().BeFalse();
        }
Exemplo n.º 5
0
        public void When_other_VoiceNoteChoices_are_null_they_are_not_equal()
        {
            // arrange
            var voiceNoteChoices = new HashSet <VoiceNoteChoice>
            {
                new(Voice.Bass, NoteMotion.Oblique, 2),
                new(Voice.Harmony, NoteMotion.Descending, 13),
                new(Voice.Melody, NoteMotion.Ascending, 124)
            };

            var noteChoice  = new NoteChoice(voiceNoteChoices);
            var noteChoiceB = new NoteChoice(null);

            // act
            var areEqual = noteChoice.Equals(noteChoiceB);

            // assert
            areEqual.Should().BeFalse();
        }