Пример #1
0
            public void Length_ReturnsLengthOfValue(string value1, string value2, string expectedValue)
            {
                var sut    = new WordCombination(new Word(value1), new Word(value2));
                var actual = sut.Value;

                Assert.That(actual, Is.EqualTo(expectedValue));
            }
Пример #2
0
            public void ObjectsWithWordsInReversedOrder_AreNotEqual()
            {
                var obj1 = new WordCombination(_word1, _word2);
                var obj2 = new WordCombination(_word2, _word1);

                Assert.That(!obj1.Equals(obj2));
                Assert.That(obj1 != obj2);
            }
Пример #3
0
            public void NullInstances_AreEqual()
            {
                WordCombination obj1 = null;
                WordCombination obj2 = null;

                Assert.That(Equals(obj1, obj2));
                Assert.That(obj1 == obj2);
            }
Пример #4
0
            public void IsNotEqualToNull()
            {
                var             obj1 = new WordCombination(_word1, _word2);
                WordCombination obj2 = null;

                Assert.That(!Equals(obj1, obj2));
                Assert.That(obj1 != obj2);
            }
Пример #5
0
            public void ToString_ReturnsValue()
            {
                var expected = $"{_word1.Value} + {_word2.Value} => {_word1.Value + _word2.Value}";
                var sut      = new WordCombination(_word1, _word2);
                var actual   = sut.ToString();

                Assert.That(actual, Is.EqualTo(expected));
            }
Пример #6
0
            public void ObjectsWithDifferentWords_AreNotEqual()
            {
                var obj1 = new WordCombination(_word1, _word2);
                var obj2 = new WordCombination(_word1, _word3);

                Assert.That(!obj1.Equals(obj2));
                Assert.That(obj1 != obj2);
            }
Пример #7
0
            public void ObjectsWithEqualWords_AreEqual()
            {
                var obj1 = new WordCombination(_word1, _word2);
                var obj2 = new WordCombination(_word1, _word2);

                Assert.That(obj1.Equals(obj2));
                Assert.That(obj1 == obj2);
                Assert.That(obj1.GetHashCode() == obj2.GetHashCode());
            }
Пример #8
0
 protected bool Equals(WordCombination other)
 {
     return(_left.Equals(other._left) && _right.Equals(other._right));
 }