Ejemplo n.º 1
0
        public void ThrowsWithExpectedMessageGivenNonMatchingString()
        {
            string name     = "Doesn't Exist";
            string expected = $"No TestEnum with Name \"{name}\" found.";
            string actual   = "";

            try
            {
                var testEnum = TestEnum.FromName(name);
            }
            catch (SmartEnumNotFoundException ex)
            {
                actual = ex.Message;
            }

            Assert.Equal(expected, actual);
        }
Ejemplo n.º 2
0
        public void ReturnsEnumGivenNoExplicitPriorUse()
        {
            string expected = "One";

            Assert.Equal(expected, TestEnum.FromName(expected).Name);
        }
Ejemplo n.º 3
0
 public void ThrowsGivenNonMatchingString()
 {
     Assert.Throws <SmartEnumNotFoundException>(() => TestEnum.FromName("Doesn't Exist"));
 }
Ejemplo n.º 4
0
 public void ThrowsGivenNull()
 {
     Assert.Throws <ArgumentNullException>(() => TestEnum.FromName(null));
 }
Ejemplo n.º 5
0
 public void ThrowsGivenEmptyString()
 {
     Assert.Throws <ArgumentException>(() => TestEnum.FromName(String.Empty));
 }
Ejemplo n.º 6
0
 public void ReturnsEnumGivenMatchingName()
 {
     Assert.Equal(TestEnum.One, TestEnum.FromName("One"));
 }