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);
public void ReturnsEnumGivenMatchingValue() { Assert.Equal(TestEnum.One, TestEnum.FromValue(1)); }
public void ReturnsDefaultEnumGivenNonMatchingValue() { var defaultEnum = TestEnum.One; Assert.Equal(defaultEnum, TestEnum.FromValue(-1, defaultEnum)); }
public void ThrowsGivenNonMatchingValue() { Assert.Throws <SmartEnumNotFoundException>(() => TestEnum.FromValue(-1)); }