public void be_equal_to_other_valueobject_with_the_same_values()
        {
            var title        = new ValueObjectTest("As You Like It");
            var anotherTitle = new ValueObjectTest("As You Like It");

            title.Should().Be(anotherTitle);
        }
        public void not_be_equal_to_other_valueobject_with_diferent_values()
        {
            var title        = new ValueObjectTest("As You Like It");
            var anotherTitle = new ValueObjectTest("Troilus and Cressida");

            title.Should().NotBe(anotherTitle);
        }
Example #3
0
        public void Given_ComparingOneObjectWithNull_When_UsingEquals_Then_ReturnsFalse()
        {
            // arrange
            var firstName       = "John";
            var lastName        = "Doe";
            var valueObjectTest = new ValueObjectTest(firstName, lastName);

            // act
            var comparisonResult = valueObjectTest.Equals(null);

            // assert
            Assert.False(comparisonResult);
        }
        public void GivenTwoDifferentObjectsWhenUsingTheNotEqualOperatorReturnsTrue(string firstName2, string lastName2)
        {
            // arrange
            var firstName1       = "John";
            var lastName1        = "Doe";
            var valueObjectTest1 = new ValueObjectTest(firstName1, lastName1);
            var valueObjectTest2 = new ValueObjectTest(firstName2, lastName2);

            // act
            var comparisonResult = valueObjectTest1 != valueObjectTest2;

            // assert
            Assert.True(comparisonResult);
        }
        public void GivenTwoDifferentObjectsWhenUsingTheEqualOperatorReturnsFalse()
        {
            // arrange
            var firstName        = "John";
            var lastName         = "Doe";
            var valueObjectTest1 = new ValueObjectTest(firstName, lastName);
            var valueObjectTest2 = new ValueObjectTest(firstName, "Jhon");

            // act
            var comparisonResult = valueObjectTest1 == valueObjectTest2;

            // assert
            Assert.False(comparisonResult);
        }
Example #6
0
        public void Given_TwoObjectsWithDifferentTypes_When_UsingEquals_Then_ReturnsFalse()
        {
            // arrange
            var firstName        = "John";
            var lastName         = "Doe";
            var valueObjectTest1 = new ValueObjectTest(firstName, lastName);
            var valueObjectTest2 = new ValueObject2Test(firstName, lastName);

            // act
            var comparisonResult = valueObjectTest1.Equals(valueObjectTest2);

            // assert
            Assert.False(comparisonResult);
        }