public void serial() { c_serializer c = new c_serializer(_fn, false); c.Open(); TaskScheduler nt = new TaskScheduler(new CommPortProxy()); // 2006.12.13 // //nt.Tasks.Add(new Task("n1", T.station,T.cmd_coll_realdata,new ImmediateTaskStrategy())); nt.Tasks.Add(new Task("n1", T.cmd_coll_realdata, new ImmediateTaskStrategy())); c.Serialize(nt); c.Close(); c = new c_serializer(_fn, true); c.Open(); TaskScheduler t = c.Deserialize() as TaskScheduler; c.Close(); Assert.IsNotNull(t); Assert.IsNotNull(t.CommPortProxy); //Assert.IsNull( t.Tasks ); Assert.IsTrue(t.Tasks.Count == 1); Assert.IsTrue(t.Tasks[0].CommCmd.GetType().Name == typeof(A_Cmd_Coll_Rd).Name); Assert.IsNull(t.ActiveTask); }
public void serialize() { c_serializer c = new c_serializer(_filename, false); c.Open(); c.Serialize(new CommPortProxy()); c.Close(); c = new c_serializer(_filename, true); c.Open(); CommPortProxy p = c.Deserialize() as CommPortProxy; c.Close(); Assert.IsNotNull(p); Assert.AreEqual(1, p.ComPort); Assert.AreEqual("9600,n,8,1", p.Settings); Assert.IsFalse(p.IsOpen); p.Open(); Assert.IsTrue(p.IsOpen); }