예제 #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);
        }