示例#1
0
        public void TestLargeMessage1()
        {
            String strings = File.ReadAllText(externalResources[0]);

            SampleInfo sample = new SampleInfo(typeof(String), strings);
            SampleTest(sample);
        }
示例#2
0
        public void TestSimpleGeneric()
        {
            SampleInfo sample = new SampleInfo(typeof(SimpleGenericClass<String>), new SimpleGenericClass<String>
            {
                GenericValue = "Hello World!",
                IntValue = 1234
            });

            SampleTest(sample);
        }
示例#3
0
        public void TestLargeMessage2()
        {
            String[] strings = new String[10];

            for(int i=0;i<strings.Length;i++)
            {
                strings[i] = File.ReadAllText(externalResources[i % externalResources.Length]);
            }

            SampleInfo sample = new SampleInfo(typeof(String[]), strings);
            SampleTest(sample);
        }
示例#4
0
        private void SampleTest(SampleInfo sample)
        {
            using (MemoryStream stream = new MemoryStream())
            {
                Serializers.Serialize(stream, sample.Source);

                stream.Position = 0;

                var result = Serializers.Deserialize(stream, sample.ExpectedType);

                Assert.IsTrue(CompareHelper.IsEqualObject(sample.Source, result));
            }
        }
示例#5
0
        public void TestSimpleDerived()
        {
            SampleInfo sample = new SampleInfo(typeof(SimpleDerivedClass), new SimpleDerivedClass
            {
                DateTime1 = DateTime.Now,
                IntValue = 1,
                IntValue1  = 4321,
                StringValue = Environment.Version.ToString(),
                StringValue1 = Environment.CurrentDirectory
            });

            SampleTest(sample);
        }
示例#6
0
        public void TestRecursiveDeclaration()
        {
            SampleInfo sample = new SampleInfo(typeof(RecursiveClass), new RecursiveClass
            {
                IntValue = 1234,
                RecusiveTag = new RecursiveClass
                {
                    IntValue = 4344,
                    RecusiveTag = null
                }
            });

            SampleTest(sample);
        }
示例#7
0
        public void TestInt16One()
        {
            SampleInfo sample = new SampleInfo(typeof(Int16), (short)1);

            SampleTest(sample);
        }
示例#8
0
        public void TestInt16Maximum()
        {
            SampleInfo sample = new SampleInfo(typeof(Int16), Int16.MaxValue);

            SampleTest(sample);
        }
示例#9
0
        public void TestInt16NullMinusOne()
        {
            SampleInfo sample = new SampleInfo(typeof(Int16?), (short)-1);

            SampleTest(sample);
        }
示例#10
0
        public void TestSpecialCharString()
        {
            SampleInfo sample = new SampleInfo(typeof(String), "\u07DF\u07DF\u07DF\u07DF\u07DF\u07DF\u07DF");

            SampleTest(sample);
        }
示例#11
0
        public void TestNullString()
        {
            SampleInfo sample = new SampleInfo(typeof(String), null);

            SampleTest(sample);
        }
示例#12
0
 public void TestSimpleGenericNull()
 {
     SampleInfo sample = new SampleInfo(typeof(SimpleGenericClass<String>), null);
     SampleTest(sample);
 }
示例#13
0
        public void TestTimeSpan()
        {
            SampleInfo sample = new SampleInfo(typeof(TimeSpan), TimeSpan.FromHours(10.5));

            SampleTest(sample);
        }
示例#14
0
        public void TestInt64Zero()
        {
            SampleInfo sample = new SampleInfo(typeof(Int64), (long)0);

            SampleTest(sample);
        }
示例#15
0
        public void TestInt64One()
        {
            SampleInfo sample = new SampleInfo(typeof(Int64), (long)1);

            SampleTest(sample);
        }
示例#16
0
        public void TestInt32Zero()
        {
            SampleInfo sample = new SampleInfo(typeof(Int32), 0);

            SampleTest(sample);
        }
示例#17
0
        public void TestInt32One()
        {
            SampleInfo sample = new SampleInfo(typeof(Int32), 1);

            SampleTest(sample);
        }
示例#18
0
        public void TestInt32NullMaximum()
        {
            SampleInfo sample = new SampleInfo(typeof(Int32?), Int32.MaxValue);

            SampleTest(sample);
        }
示例#19
0
        public void TestInt32Null()
        {
            SampleInfo sample = new SampleInfo(typeof(Int32?), null);

            SampleTest(sample);
        }
示例#20
0
        public void TestInt16Zero()
        {
            SampleInfo sample = new SampleInfo(typeof(Int16), (short)0);

            SampleTest(sample);
        }
示例#21
0
        public void TestCustomEnumArray()
        {
            SampleInfo sample = new SampleInfo(typeof(CustomEnum[]), new CustomEnum[]{ CustomEnum.Three, CustomEnum.Two, CustomEnum.One});

            SampleTest(sample);
        }
示例#22
0
        public void TestCustomLongEnum()
        {
            SampleInfo sample = new SampleInfo(typeof(CustomLongEnum), CustomLongEnum.Three);

            SampleTest(sample);
        }
示例#23
0
        public void TestTimeSpanNull()
        {
            SampleInfo sample = new SampleInfo(typeof(TimeSpan?), null);

            SampleTest(sample);
        }
示例#24
0
        public void TestTimeSpanNullTenHoursAndHalf()
        {
            SampleInfo sample = new SampleInfo(typeof(TimeSpan?), TimeSpan.FromHours(10.5));

            SampleTest(sample);
        }
示例#25
0
        public void TestEmptyString()
        {
            SampleInfo sample = new SampleInfo(typeof(String), "");

            SampleTest(sample);
        }
示例#26
0
        public void TestDateTimeUnspecified()
        {
            SampleInfo sample = new SampleInfo(typeof(DateTime), new DateTime(DateTime.UtcNow.Ticks, DateTimeKind.Unspecified));

            SampleTest(sample);
        }
示例#27
0
        public void TestSmallString()
        {
            SampleInfo sample = new SampleInfo(typeof(String), "Hello World!");

            SampleTest(sample);
        }
示例#28
0
        public void TestDateTimeUtc()
        {
            SampleInfo sample = new SampleInfo(typeof(DateTime), DateTime.UtcNow);

            SampleTest(sample);
        }
示例#29
0
        public void TestDateTimeLocal()
        {
            SampleInfo sample = new SampleInfo(typeof(DateTime), DateTime.Now);

            SampleTest(sample);
        }
示例#30
0
        public void TestDateTimeNull()
        {
            SampleInfo sample = new SampleInfo(typeof(DateTime?), null);

            SampleTest(sample);
        }