Ejemplo n.º 1
0
        public void ThrowsWithExpectedMessageGivenNonMatchingValue()
        {
            string expected = $"No TestEnum with Value -1 found.";
            string actual = "";

            try
            {
                var testEnum = TestEnum.FromValue(-1);
            }
            catch (SmartEnumNotFoundException ex)
            {
                actual = ex.Message;
            }

            Assert.Equal(expected, actual);
Ejemplo n.º 2
0
 public void ReturnsEnumGivenMatchingValue()
 {
     Assert.Equal(TestEnum.One, TestEnum.FromValue(1));
 }
Ejemplo n.º 3
0
        public void ReturnsDefaultEnumGivenNonMatchingValue()
        {
            var defaultEnum = TestEnum.One;

            Assert.Equal(defaultEnum, TestEnum.FromValue(-1, defaultEnum));
        }
Ejemplo n.º 4
0
 public void ThrowsGivenNonMatchingValue()
 {
     Assert.Throws <SmartEnumNotFoundException>(() => TestEnum.FromValue(-1));
 }