Пример #1
0
        public void Should_not_throw_when_mapping_unknown_value_for_enum()
        {
            var foo = new FooWithEnumAsString {
                SuperEnum = "asdf"
            };
            var copy = Mapper.Map <FooWithEnum>(foo);

            Assert.Equal(default(SuperEnum), copy.SuperEnum);
        }
Пример #2
0
        public void Should_map_string_to_enum()
        {
            var foo = new FooWithEnumAsString {
                SuperEnum = SuperEnum.Bar.ToString()
            };
            var copy = Mapper.Map <FooWithEnum>(foo);

            Assert.Equal(SuperEnum.Bar, copy.SuperEnum);
        }