示例#1
0
        public void ChangeType_LesserEnumWithoutHitStrict_ThrowsException()
        {
            // arrange
            Action fail = () => EnumHelper <TestEnum> .ChangeType <LesserEnum>(TestEnum.C, true);

            // act
            fail.Should().Throw <ArgumentException>();
        }
示例#2
0
        public void ChangeType_BiggerEnumStrict_Works()
        {
            // act
            var result = EnumHelper <TestEnum> .ChangeType <BiggerEnum>(TestEnum.B, true);

            // assert
            result.Should().Be(BiggerEnum.B);
        }
示例#3
0
        public void ChangeType_SameIndexEnumStrict_ThrowsException()
        {
            // arrange
            Action fail = () => EnumHelper <TestEnum> .ChangeType <SameIndexEnum>(TestEnum.B, true);

            // act + assert
            fail.Should().Throw <ArgumentException>();
        }
示例#4
0
        public void ChangeType_SubstituteEnumWithOtherKeyStrict_ThrowsException()
        {
            // arrange
            Action fail = () => EnumHelper <TestEnum> .ChangeType <LongTestEnum>(TestEnum.B, true);

            // act + assert
            fail.Should().Throw <ArgumentException>();
        }
示例#5
0
        public void ChangeType_SubstituteEnumStrict_Works()
        {
            // act
            var result = EnumHelper <TestEnum> .ChangeType <SubstituteEnum>(TestEnum.B, true);

            // assert
            result.Should().Be(SubstituteEnum.B);
        }
示例#6
0
        public void ChangeType_LesserEnumWithHit_ReturnsTrue()
        {
            // act
            var result = EnumHelper <TestEnum> .ChangeType <LesserEnum>(TestEnum.B);

            // assert
            result.Should().Be(LesserEnum.B);
        }
示例#7
0
        public void ChangeType_SameIndexEnum_Works()
        {
            // act
            var result = EnumHelper <TestEnum> .ChangeType <SameIndexEnum>(TestEnum.B);

            // assert
            result.Should().Be(SameIndexEnum.Y);
        }
示例#8
0
        public void ChangeType_SubstituteEnumWithOtherKey_Works()
        {
            // act
            var result = EnumHelper <TestEnum> .ChangeType <LongTestEnum>(TestEnum.B);

            // assert
            result.Should().Be(LongTestEnum.B);
        }