示例#1
0
        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));
        }
示例#2
0
        public void OnFromValueInvalidValueThrowsOutOfRangeException()
        {
            var expectedValue = TestSharpEnum.InvalidValue;

            var exception = Record.Exception(() => TestSharpEnum.FromValue(expectedValue));

            Assert.NotNull(exception);
            Assert.IsType <ArgumentOutOfRangeException>(exception);
        }
示例#3
0
        public void ValidFromValuesDoNotThrowError(int value)
        {
            var exception = Record.Exception(() => TestSharpEnum.FromValue(value));

            Assert.Null(exception);
        }