Esempio n. 1
0
        public void MultipleSerializationTest()
        {
            var input1 = new EnumTestType();

            input1.Field = EnumType.Three;

            var input2 = new GenericType <int, int>();

            input2.FieldOne = 5;
            input2.FieldTwo = 10;

            var stream = new MemoryStream();

            BinSerializer.Serialize(stream, input1);
            BinSerializer.Serialize(stream, input2);
            stream.Position = 0;

            var output1 = BinSerializer.Deserialize <EnumTestType>(stream);
            var output2 = BinSerializer.Deserialize <GenericType <int, int> >(stream);

            Assert.AreEqual(input1.Field, output1.Field);

            Assert.AreEqual(input2.FieldOne, output2.FieldOne);
            Assert.AreEqual(input2.FieldTwo, output2.FieldTwo);
        }
Esempio n. 2
0
        public void EnumTest()
        {
            var input = new EnumTestType();

            input.Field = EnumType.One;

            var output = SerializeDeserialize(input);

            Assert.AreEqual(input.Field, output.Field);
        }
        public void EnumTestType_WhenGetCombinations_ShouldReturnCorrectCombinations()
        {
            var enumTestType = new EnumTestType();
            var combinations = enumTestType.GetTestValues("test", typeof(TestEnum), TestEnum.FirstTest, null, null);

            Assert.AreEqual(2, combinations.Length);

            Assert.AreEqual("test", combinations[0].MemberPath);
            Assert.AreEqual(TestEnum.FirstTest, combinations[0].Value);
            Assert.AreEqual(TestEnum.FirstTest, combinations[0].LogValue);

            Assert.AreEqual("test", combinations[1].MemberPath);
            Assert.AreEqual(TestEnum.SecondTest, combinations[1].Value);
            Assert.AreEqual(TestEnum.SecondTest, combinations[1].LogValue);
        }