public void NonSerializableObjectIsSerializable() { var self = new NonSerializableObject(); bool actual = self.IsSerializable(); Assert.IsFalse(actual); }
public void TryGetFromFileFailure() { NonSerializableObject result = null; notXml.WriteToFile(path); var actual = Deserializer <NonSerializableObject> .TryGetInstanceFromFile(path, ref result, "http://pragma.no/Pragma.Core.CrossCuttingTest.Mock.NonSerializableObject"); Assert.IsNull(result); Assert.IsFalse(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 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); }
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 async Task DuplexObservableWithNonSerializablePayload() { var service = TestService.Create(TestService.UnrestrictedOptions, new[] { typeof(NonSerializableObject) }, Observable.Return(new TestContext())); var obj = new NonSerializableObject(); var local = Observable.Return(obj); var results = await service.QueryAsync(source => from context in source from value in local select value); QactiveAssert.AreEqual(results, OnNext(obj), OnCompleted <NonSerializableObject>()); }
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 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 TryGetNonSerializable(string domainName) { if (_childProxies.ContainsKey(domainName)) { try { NonSerializableObject s = _childProxies[domainName].GetNonSerializableObject(); Console.WriteLine("Not possible to get here"); } catch (Exception ex) { Console.WriteLine("You get an exception from {0}", domainName); Console.WriteLine(ex); } } else { Console.WriteLine("Child domain {0} does not exist", domainName); } }
public void ThreadAffinitizedDataObject(NonSerializableObject o) { Assert.Equal(System.Diagnostics.Process.GetCurrentProcess().Id, o.ProcessId); Assert.Equal(Environment.CurrentManagedThreadId, o.ThreadId); }
/// <summary> /// Common Test code to try and serialize a non serializable object /// </summary> /// <param name="provider"> /// The provider to use to perform the serialization /// </param> public static void Serialize_NonSerializableObject(SerializationProvider provider) { NonSerializableObject obj1 = new NonSerializableObject(); provider.Serialize(obj1); }
public ChildProxy() { _referencedObject = new ReferencedObject(); _serializableObject = new SerializableObject(); _nonSerializableObject = new NonSerializableObject(); }
public void Serialize_NonSerializableObject_error() { var serializer = new XmlSerializer(typeof(NonSerializableObject)); var o = new NonSerializableObject("any"); var m = new MemoryStream(); serializer.Serialize(m,o); }
public NonSerializableAttribute(int arg1, int arg2) { prop1 = arg1; prop2 = new NonSerializableObject(arg1); }