public void ApplyEqualsOfTToNullMustReturnExpectedResultForStructObject()
        {
            // Arrange
            var bikeDumbStructObject = new BikeDumbStructObject("Giant", "Revolt", 2020);

            // Act
            var result = EqComponent.ApplyEqualsOfTToNull <BikeDumbStructObject>(bikeDumbStructObject);

            // Assert
            result.Should().BeSuccess();
        }
        public void ApplyEqualsOfTToNullMustReturnExpectedResultForClassObjectDefaultNull()
        {
            // Arrange
            BikeDumbClassObject bikeClassObject = default;

            // Act
            var result = EqComponent.ApplyEqualsOfTToNull <BikeDumbClassObject>(bikeClassObject);

            // Assert
            result.Should().BeFailure("Equals returned 'true' on expected non-equal objects.");
        }
        public void ApplyEqualsOfTToNullMustReturnExpectedResultForStructObjectDefault()
        {
            // Arrange
            BikeDumbStructObject bikeStructObject = default;

            // Act
            var result = EqComponent.ApplyEqualsOfTToNull <BikeDumbStructObject>(bikeStructObject);

            // Assert
            result.Should().BeSuccess();
        }
Esempio n. 4
0
        public void ApplyOperatorEqualityToNullMustReturnExpectedResultForStructOperatorObjectDefaultNull()
        {
            // Arrange
            BikeOperatorStructObject bikeOperatorStructObject = default;

            // Act
            var result = EqComponent.ApplyOperatorEqualityToNull <BikeOperatorStructObject>(bikeOperatorStructObject);

            // Assert
            result.Should().BeSuccess();
        }
Esempio n. 5
0
        public void ApplyOperatorEqualityToNullMustReturnExpectedResultForStructOperatorObjectNotDefault()
        {
            // Arrange
            var bikeOperatorStructObject = new BikeOperatorStructObject("Giant", "Revolt", 2020);

            // Act
            var result = EqComponent.ApplyOperatorEqualityToNull <BikeOperatorStructObject>(bikeOperatorStructObject);

            // Assert
            result.Should().BeSuccess();
        }
Esempio n. 6
0
        public void ApplyOperatorEqualityToNullMustReturnExpectedResultForClassDumbObjectNotNull()
        {
            // Arrange
            var bikeDumbClassObject = new BikeDumbClassObject("Giant", "Revolt", 2020);

            // Act
            var result = EqComponent.ApplyOperatorEqualityToNull <BikeDumbClassObject>(bikeDumbClassObject);

            // Assert
            result.Should().BeFailure("Type does not override equality operator.");
        }
        public void ApplyEqualsMustReturnExpectedResultForStructObjectsWithSameEqualsResultAndExpectedEqualFalse()
        {
            // Arrange
            var first  = new BikeWithEqualsStructObject("Giant", "Revolt", 2020);
            var second = new BikeWithEqualsStructObject("Giant", "Revolt", 2020);

            // Act
            var result = EqComponent.ApplyEquals <BikeWithEqualsStructObject>(first, second, false);

            // Assert
            result.Should().BeFailure("Equals returned 'true' on expected non-equal objects.");
        }
        public void ApplyEqualsMustReturnExpectedResultForStructObjectsWithSameEqualsResultAndExpectedEqualTrue()
        {
            // Arrange
            var first  = new BikeWithEqualsStructObject("Giant", "Revolt", 2020);
            var second = new BikeWithEqualsStructObject("Giant", "Revolt", 2020);

            // Act
            var result = EqComponent.ApplyEquals <BikeWithEqualsStructObject>(first, second, true);

            // Assert
            result.Should().BeSuccess();
        }
        public void ApplyEqualsMustReturnExpectedResultForClassObjectsWithDifferentEqualsResultAndExpectedEqualFalse()
        {
            // Arrange
            var first  = new BikeWithEqualsClassObject("Giant", "Revolt", 2020);
            var second = new BikeWithEqualsClassObject("Giant", "Liv", 2020);

            // Act
            var result = EqComponent.ApplyEquals <BikeWithEqualsClassObject>(first, second, false);

            // Assert
            result.Should().BeSuccess();
        }
        public void ApplyEqualsMustReturnExpectedResultForClassObjectsWithDifferentEqualsResultAndExpectedEqualTrue()
        {
            // Arrange
            var first  = new BikeWithEqualsClassObject("Giant", "Revolt", 2020);
            var second = new BikeWithEqualsClassObject("Giant", "Liv", 2020);

            // Act
            var result = EqComponent.ApplyEquals <BikeWithEqualsClassObject>(first, second, true);

            // Assert
            result.Should().BeFailure("Equals returned 'false' on expected equal objects.");
        }
        public void ApplyGetHashCodeOnEqualObjectsMustReturnExpectedResultForStructObjectsWithDifferentHashCode()
        {
            // Arrange
            var first  = new BikeWithHashCodeStructObject("Giant", "Revolt", 2020);
            var second = new BikeWithHashCodeStructObject("Giant", "Liv", 2020);

            // Act
            var result = EqComponent.ApplyGetHashCodeOnEqualObjects <BikeWithHashCodeStructObject>(first, second);

            // Assert
            result.Should().BeFailure("GetHashCode of equal objects returned different values.");
        }
        public void ApplyGetHashCodeOnEqualObjectsMustReturnExpectedResultForStructObjectsWithSameHashCode()
        {
            // Arrange
            var first  = new BikeWithHashCodeStructObject("Giant", "Revolt", 2020);
            var second = new BikeWithHashCodeStructObject("Giant", "Revolt", 2020);

            // Act
            var result = EqComponent.ApplyGetHashCodeOnEqualObjects <BikeWithHashCodeStructObject>(first, second);

            // Assert
            result.Should().BeSuccess();
        }
        public void ApplyOperatorInequalityMustReturnExpectedResultForStructObjectsThatAreActuallyUnequalFalseAndExpectedUnequalFalse()
        {
            // Arrange
            var first  = new BikeOperatorEqualityStructObject("Giant", "Revolt", 2020);
            var second = new BikeOperatorEqualityStructObject("Giant", "Revolt", 2020);

            // Act
            var result = EqComponent.ApplyOperatorInequality <BikeOperatorEqualityStructObject>(first, second, false);

            // Assert
            result.Should().BeSuccess();
        }
        public void ApplyOperatorInequalityMustReturnExpectedResultForStructObjectsThatAreActuallyUnequalFalseAndExpectedUnequalTrue()
        {
            // Arrange
            var first  = new BikeOperatorEqualityStructObject("Giant", "Revolt", 2020);
            var second = new BikeOperatorEqualityStructObject("Giant", "Revolt", 2020);

            // Act
            var result = EqComponent.ApplyOperatorInequality <BikeOperatorEqualityStructObject>(first, second, true);

            // Assert
            result.Should().BeFailure("Inequality operator returned 'false' on expected non-equal objects.");
        }