public void SerializeSafeObjectToFile()
        {

            var self = new NonSerializableObject();
            self.AString = "test";
            self.AnInt = 12;
            if (File.Exists(filePath))
                File.Delete(filePath);
            self.SerializeToFile(filePath, true);
            Assert.IsTrue(File.Exists(filePath));
        }
 public void SerializeUnsafeObjectFails()
 {
     var self = new NonSerializableObject();
     self.AString = "test";
     self.AnInt = 12;
     string actual = null;
     try
     {
         actual = self.Serialize("http://unsafe.com/");
         Assert.Fail();
     }
     catch
     {
         Assert.AreEqual(null, actual);
     }
 }
 public void SerializeUnsafeObjectSuccess()
 {
     var self = new NonSerializableObject();
     self.AString = "test";
     self.AnInt = 12;
     var actual = self.Serialize("http://unsafe.com/", true);
     Assert.IsTrue(actual.Contains("test"));
     Assert.IsTrue(actual.Contains("http://unsafe.com/"));
 }
 public void NonSerializableObjectIsSerializable()
 {
     var self = new NonSerializableObject();
     bool actual = self.IsSerializable();
     Assert.IsFalse(actual);
 }
 public void TryGetFromFileSuccess()
 {
     xml.WriteToFile(path);
     NonSerializableObject result = null;
     NonSerializableObject expected = new NonSerializableObject() { AnInt = 12, AString = "test" };
     var actual = Deserializer<NonSerializableObject>.TryGetInstanceFromFile(path, ref result,"http://pragma.no/Pragma.Core.CrossCuttingTest.Mock.NonSerializableObject");
     Assert.IsNotNull(result);
     Assert.AreEqual(expected.AString, result.AString);
     Assert.AreEqual(expected.AnInt, result.AnInt);
     Assert.IsTrue(actual);
 }
 public void DeserializeTest()
 {
     var actual = Deserializer<NonSerializableObject>.Deserialize(xml,"http://pragma.no/Pragma.Core.CrossCuttingTest.Mock.NonSerializableObject");
     NonSerializableObject expected = new NonSerializableObject() { AnInt = 12, AString = "test" };
     Assert.AreEqual(expected.AString, actual.AString);
     Assert.AreEqual(expected.AnInt, actual.AnInt);
 }