Esempio n. 1
0
        public void Should_Be_Implicitly_Convertible_To_A_String()
        {
            // arrange
            var a1 = new HelperStringEnum("a");

            // act
            var a2 = (string)a1;

            // assert
            Assert.That(a2, Is.EqualTo(a1.Value));
        }
Esempio n. 2
0
        public void Should_Be_Greater_Than_When_Compared_To_Null()
        {
            // arrange
            var a = new HelperStringEnum("a");

            // act
            int comparisonResult = a.CompareTo(null);

            // assert
            Assert.That(comparisonResult, Is.GreaterThan(0));
        }
Esempio n. 3
0
        public void Should_Not_Be_Equal_When_Casted_To_Object_And_Tested_With_Null()
        {
            object a = new HelperStringEnum("a");
            var    b = (HelperStringEnum)null;

            // act
            bool isEquatable = a.Equals(b);

            // assert
            Assert.That(isEquatable, Is.False);
        }
Esempio n. 4
0
        public void Should_Be_Equal_To_Itself_When_ToStringed()
        {
            // arrange
            var a1 = new HelperStringEnum("a");

            // act
            string a2 = a1.ToString();

            // assert
            Assert.That(a2, Is.EqualTo(a1.Value));
        }
Esempio n. 5
0
        public void Should_Be_Greater_When_Compared()
        {
            // arrange
            var a = new HelperStringEnum("a");
            var b = new HelperStringEnum("b");

            // act
            int comparisonResult = b.CompareTo(a);

            // assert
            Assert.That(comparisonResult, Is.GreaterThan(0));
        }
Esempio n. 6
0
        public void Should_Be_Equal_When_Compared()
        {
            // arrange
            var a1 = new HelperStringEnum("a");
            var a2 = new HelperStringEnum("a");

            // act
            int comparisonResult = a1.CompareTo(a2);

            // assert
            Assert.That(comparisonResult, Is.EqualTo(0));
        }
Esempio n. 7
0
        public void Should_Be_Equal_When_Casted_To_Object()
        {
            // arrange
            object a1 = new HelperStringEnum("a");
            var    a2 = new HelperStringEnum("a");

            // act
            bool isEquatable = a1.Equals(a2);

            // assert
            Assert.That(isEquatable, Is.True);
        }
Esempio n. 8
0
        public void Should_Not_Be_Equal_When_Casted_To_Object()
        {
            // arrange
            object a = new HelperStringEnum("a");
            var    b = new HelperStringEnum("b");

            // act
            bool isEquatable = a.Equals(b);

            // assert
            Assert.That(isEquatable, Is.False);
        }
Esempio n. 9
0
        public void Should_Be_Less_Than_When_Compared()
        {
            // arrange
            var a = new HelperStringEnum("a");
            var b = new HelperStringEnum("b");

            // act
            int comparisonResult = a.CompareTo(b);

            // assert
            Assert.That(comparisonResult, Is.LessThan(0));
        }
Esempio n. 10
0
        public void Should_Be_Equal_When_Hashed()
        {
            // arrange
            var a1 = new HelperStringEnum("a");
            var a2 = new HelperStringEnum("a");

            // act
            int hashCode1 = a1.GetHashCode();
            int hashCode2 = a2.GetHashCode();

            // assert
            Assert.That(hashCode1, Is.EqualTo(hashCode2));
        }