public void FromValueLoadsCorrectEnum(int value, string expectedName, TestSharpEnum hasEnumFlags) { var newEnum = TestSharpEnum.FromValue(value); Assert.Equal(value, newEnum.Value); Assert.Equal(expectedName, newEnum.Name); Assert.True(newEnum.HasFlag(hasEnumFlags)); }
public void OnFromValueInvalidValueThrowsOutOfRangeException() { var expectedValue = TestSharpEnum.InvalidValue; var exception = Record.Exception(() => TestSharpEnum.FromValue(expectedValue)); Assert.NotNull(exception); Assert.IsType <ArgumentOutOfRangeException>(exception); }
public void ValidFromValuesDoNotThrowError(int value) { var exception = Record.Exception(() => TestSharpEnum.FromValue(value)); Assert.Null(exception); }