Beispiel #1
0
        public void TestGetDescriptionNoFallback()
        {
            SampleEnum val  = SampleEnum.Val2;
            string     desc = val.GetDescription();

            Assert.AreEqual("Val2", desc);
        }
Beispiel #2
0
        public void TestGetDescriptionOutOfRange()
        {
            SampleEnum val  = (SampleEnum)3;
            string     desc = val.GetDescription();

            Assert.AreEqual("Val2", desc);
        }
Beispiel #3
0
        public void TestGetDescription()
        {
            SampleEnum val1 = SampleEnum.Val1;
            string     desc = val1.GetDescription();

            Assert.AreEqual("Value: 1", desc);
        }
Beispiel #4
0
        public void GetDescription_DefaultEnum_ReturnZeroToString()
        {
            // Arrange
            SampleEnum sample = default;

            // Act
            var ret = sample.GetDescription();

            // Assert
            ret.Should().Be(0.ToString());
        }
Beispiel #5
0
        public void GetDescription_NoMatchingValue_ReturnToString()
        {
            // Arrange
            var        evil   = 666;
            SampleEnum sample = (SampleEnum)evil;

            // Act
            var ret = sample.GetDescription();

            // Assert
            ret.Should().Be(evil.ToString());
        }