public void TestLargeMessage1() { String strings = File.ReadAllText(externalResources[0]); SampleInfo sample = new SampleInfo(typeof(String), strings); SampleTest(sample); }
public void TestSimpleGeneric() { SampleInfo sample = new SampleInfo(typeof(SimpleGenericClass<String>), new SimpleGenericClass<String> { GenericValue = "Hello World!", IntValue = 1234 }); SampleTest(sample); }
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); }
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)); } }
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); }
public void TestRecursiveDeclaration() { SampleInfo sample = new SampleInfo(typeof(RecursiveClass), new RecursiveClass { IntValue = 1234, RecusiveTag = new RecursiveClass { IntValue = 4344, RecusiveTag = null } }); SampleTest(sample); }
public void TestInt16One() { SampleInfo sample = new SampleInfo(typeof(Int16), (short)1); SampleTest(sample); }
public void TestInt16Maximum() { SampleInfo sample = new SampleInfo(typeof(Int16), Int16.MaxValue); SampleTest(sample); }
public void TestInt16NullMinusOne() { SampleInfo sample = new SampleInfo(typeof(Int16?), (short)-1); SampleTest(sample); }
public void TestSpecialCharString() { SampleInfo sample = new SampleInfo(typeof(String), "\u07DF\u07DF\u07DF\u07DF\u07DF\u07DF\u07DF"); SampleTest(sample); }
public void TestNullString() { SampleInfo sample = new SampleInfo(typeof(String), null); SampleTest(sample); }
public void TestSimpleGenericNull() { SampleInfo sample = new SampleInfo(typeof(SimpleGenericClass<String>), null); SampleTest(sample); }
public void TestTimeSpan() { SampleInfo sample = new SampleInfo(typeof(TimeSpan), TimeSpan.FromHours(10.5)); SampleTest(sample); }
public void TestInt64Zero() { SampleInfo sample = new SampleInfo(typeof(Int64), (long)0); SampleTest(sample); }
public void TestInt64One() { SampleInfo sample = new SampleInfo(typeof(Int64), (long)1); SampleTest(sample); }
public void TestInt32Zero() { SampleInfo sample = new SampleInfo(typeof(Int32), 0); SampleTest(sample); }
public void TestInt32One() { SampleInfo sample = new SampleInfo(typeof(Int32), 1); SampleTest(sample); }
public void TestInt32NullMaximum() { SampleInfo sample = new SampleInfo(typeof(Int32?), Int32.MaxValue); SampleTest(sample); }
public void TestInt32Null() { SampleInfo sample = new SampleInfo(typeof(Int32?), null); SampleTest(sample); }
public void TestInt16Zero() { SampleInfo sample = new SampleInfo(typeof(Int16), (short)0); SampleTest(sample); }
public void TestCustomEnumArray() { SampleInfo sample = new SampleInfo(typeof(CustomEnum[]), new CustomEnum[]{ CustomEnum.Three, CustomEnum.Two, CustomEnum.One}); SampleTest(sample); }
public void TestCustomLongEnum() { SampleInfo sample = new SampleInfo(typeof(CustomLongEnum), CustomLongEnum.Three); SampleTest(sample); }
public void TestTimeSpanNull() { SampleInfo sample = new SampleInfo(typeof(TimeSpan?), null); SampleTest(sample); }
public void TestTimeSpanNullTenHoursAndHalf() { SampleInfo sample = new SampleInfo(typeof(TimeSpan?), TimeSpan.FromHours(10.5)); SampleTest(sample); }
public void TestEmptyString() { SampleInfo sample = new SampleInfo(typeof(String), ""); SampleTest(sample); }
public void TestDateTimeUnspecified() { SampleInfo sample = new SampleInfo(typeof(DateTime), new DateTime(DateTime.UtcNow.Ticks, DateTimeKind.Unspecified)); SampleTest(sample); }
public void TestSmallString() { SampleInfo sample = new SampleInfo(typeof(String), "Hello World!"); SampleTest(sample); }
public void TestDateTimeUtc() { SampleInfo sample = new SampleInfo(typeof(DateTime), DateTime.UtcNow); SampleTest(sample); }
public void TestDateTimeLocal() { SampleInfo sample = new SampleInfo(typeof(DateTime), DateTime.Now); SampleTest(sample); }
public void TestDateTimeNull() { SampleInfo sample = new SampleInfo(typeof(DateTime?), null); SampleTest(sample); }