Beispiel #1
0
        public void ValueType_CompareToOld_GivenNonCC_ExpectArgumentException()
        {
            // Arrange
            var cc1 = new CalorieCount(20);
            var cc2 = "twenty";

            // Act
            var result = cc1.CompareTo((object)cc2);

            // Assert
        }
Beispiel #2
0
        public void ValueType_CompareToOld_GivenNull_ExpectArgumentNullException()
        {
            // Arrange
            var    cc1 = new CalorieCount(20);
            object cc2 = null;

            // Act
            var result = cc1.CompareTo(cc2);

            // Assert
        }
Beispiel #3
0
        public void ValueType_CompareTo_GivenCCEqualValue_ExpectZero()
        {
            // Arrange
            var cc1 = new CalorieCount(20);
            var cc2 = new CalorieCount(20);

            // Act
            var result = cc1.CompareTo(cc2);

            // Assert
            Assert.AreEqual(0, result);
        }
Beispiel #4
0
        public void ValueType_CompareTo_GivenCCLesserValue_ExpectNegative()
        {
            // Arrange
            var cc1 = new CalorieCount(10);
            var cc2 = new CalorieCount(20);

            // Act
            var result = cc1.CompareTo(cc2);

            // Assert
            Assert.IsTrue(result < 0);
        }
Beispiel #5
0
        public void ValueType_CompareToOld_GivenCCGreaterValue_ExpectPositive()
        {
            // Arrange
            var cc1 = new CalorieCount(20);
            var cc2 = new CalorieCount(10);

            // Act
            var result = cc1.CompareTo((object)cc2);

            // Assert
            Assert.IsTrue(result > 0);
        }