Пример #1
0
        public void EnumTest()
        {
            var serialiser = new QueryStringSerialiser<SimpleEnumTestClass>();

            var test = new SimpleEnumTestClass();

            var mapped = serialiser.Map(test);
            var output = serialiser.Load(mapped);

            Assert.AreEqual(test, output);
        }
Пример #2
0
        public void BadValueBadParseEnumTest()
        {
            var serialiser = new QueryStringSerialiser<BadValueEnumTestClass>();

            var test = new BadValueEnumTestClass { Test = BadValueEnum.False };

            var mapped = serialiser.Map(test);
            var output = serialiser.Load(mapped);

            Assert.AreEqual(test, output);

            // And there's your problem, this will pass.
            Assert.AreEqual(BadValueEnum.True, BadValueEnum.False);
        }
Пример #3
0
        public void InvalidMaxValueEnumTest()
        {
            var serialiser = new QueryStringSerialiser<SimpleEnumTestClass>();

            var test = new SimpleEnumTestClass { Test = (TestEnum)int.MaxValue };

            var mapped = serialiser.Map(test);
            var output = serialiser.Load(mapped);

            Assert.AreEqual(test, output);
        }