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); }
public void ReturnsEnumGivenNoExplicitPriorUse() { string expected = "One"; Assert.Equal(expected, TestEnum.FromName(expected).Name); }
public void ThrowsGivenNonMatchingString() { Assert.Throws <SmartEnumNotFoundException>(() => TestEnum.FromName("Doesn't Exist")); }
public void ThrowsGivenNull() { Assert.Throws <ArgumentNullException>(() => TestEnum.FromName(null)); }
public void ThrowsGivenEmptyString() { Assert.Throws <ArgumentException>(() => TestEnum.FromName(String.Empty)); }
public void ReturnsEnumGivenMatchingName() { Assert.Equal(TestEnum.One, TestEnum.FromName("One")); }