internal void AreEqual(CSharpSelectedTypesEncoding p2) { Assert.AreEqual<bool>(this.BooleanType, p2.BooleanType); Assert.AreEqual<string>(this.StringType, p2.StringType); Assert.AreEqual<float>(this.floatType, p2.floatType); Assert.AreEqual<int>(this.intType, p2.intType); Assert.AreEqual<DateTime>(this.DateTimeType, p2.DateTimeType); Assert.AreEqual<Guid>(this.GuidType, p2.GuidType); CollectionAssert.AreEqual(this.ByteStringType, p2.ByteStringType); }
public void XmlSerializerTestMethod() { // Create a new instance of the Person class and serialize it to an XML file. CSharpSelectedTypesEncoding _p1 = new CSharpSelectedTypesEncoding(); string _fileName = "DataContractExample.xml"; XmlDataContractSerializers.Save<CSharpSelectedTypesEncoding>(new FileInfo(_fileName), _p1, (x, y, z) => Assert.AreEqual(System.Diagnostics.TraceEventType.Verbose, x)); FileInfo _newFile = new FileInfo(_fileName); Assert.IsTrue(_newFile.Exists); CSharpSelectedTypesEncoding _p2 = XmlDataContractSerializers.Load<CSharpSelectedTypesEncoding>(new FileInfo(_fileName), (x, y, z) => Assert.AreEqual<System.Diagnostics.TraceEventType>(System.Diagnostics.TraceEventType.Verbose, x)); Assert.IsNotNull(_p2); _p1.AreEqual(_p2); }