コード例 #1
0
        public void DeserializeEnumStrict_ValidString_ReturnsCorrectValue()
        {
            const UtilsTest definedEnumValue = UtilsTest.One;
            var             inputString      = definedEnumValue.ToString();

            EnumSerializer.DeserializeEnumStrict <UtilsTest>(inputString).Should().Be(definedEnumValue);
            EnumSerializer.DeserializeEnumStrict <UtilsTest>(inputString.ToLower()).Should().Be(definedEnumValue);
        }
コード例 #2
0
        public void DeserializeEnumStrict_ValidFlagString_ReturnsCorrectValue()
        {
            const ClinicalInformation definedEnumValue = ClinicalInformation.Meningitis | ClinicalInformation.Pneumonia;
            var inputString = definedEnumValue.ToString();

            EnumSerializer.DeserializeEnumStrict <ClinicalInformation>(inputString).Should().Be(definedEnumValue);
            EnumSerializer.DeserializeEnumStrict <ClinicalInformation>(inputString.ToLower())
            .Should()
            .Be(definedEnumValue);
        }
コード例 #3
0
 public void DeserializeEnumStrict_ValidDisplayString_ReturnsCorrectValue(string inputString,
                                                                          UtilsTest definedEnumValue)
 {
     EnumSerializer.DeserializeEnumStrict <UtilsTest>(inputString).Should().Be(definedEnumValue);
     EnumSerializer.DeserializeEnumStrict <UtilsTest>(inputString.ToLower()).Should().Be(definedEnumValue);
 }
コード例 #4
0
 public void DeserializeEnumStrict_InvalidString_ThrowsException(
     [Values("Apple", "12345")] string value)
 {
     Assert.Throws <Exception>(() => EnumSerializer.DeserializeEnumStrict <UtilsTest>(value));
 }