public void MessageRoundTrip() { List<IMotion> motions = new List<IMotion> { new LinearMotion(1, new Vector(5,10),new Vector(3,5.5)), new CircularMotion(30, 1, new Angle(0), new Angle(0), 1, Vector.Zero), new LinearMotion(500, new Vector(7,20),new Vector(5,100)), new CircularMotion(670, 0, new Angle(0), new Angle(-Math.PI), 1, Vector.Zero), new CircularMotion(1500, 0, new Angle(-Math.PI / 2), new Angle(1), 1, Vector.Zero) }; const string name = "bobby"; var original = new PathMessage(name, motions); var serialiser = new MessageSerialiser(); serialiser.Register(typeof(PathMessage)); var text = serialiser.Serialise(original); var deserialised = (PathMessage)serialiser.Deserialise(text); Assert.AreEqual(name, deserialised.Name); Assert.AreEqual(motions, deserialised.Motion.Path); }
public void RoundTrip() { var original = new SelectedObjectMessage("Louie"); var serialiser = new MessageSerialiser(); serialiser.Register(typeof(SelectedObjectMessage)); var text = serialiser.Serialise(original); var deserialised = (SelectedObjectMessage)serialiser.Deserialise(text); Assert.AreEqual(original.SelectedName, deserialised.SelectedName); }
public void RoundTrip() { var original = new SetPathToTargetMessage(new Vector(5.3, 7), 15000); var serialiser = new MessageSerialiser(); serialiser.Register(typeof(SetPathToTargetMessage)); var text = serialiser.Serialise(original); var deserialised = (SetPathToTargetMessage)serialiser.Deserialise(text) ; Assert.AreEqual(original.WorldPosition, deserialised.WorldPosition); Assert.AreEqual(original.Time, deserialised.Time); }
public void RoundTrip() { const ulong time = 550000; var original = new TimeUpdateMessage(time); var serialiser = new MessageSerialiser(); serialiser.Register(typeof(TimeUpdateMessage)); var text = serialiser.Serialise(original); var deserialised = (TimeUpdateMessage)serialiser.Deserialise(text); Assert.AreEqual(time, deserialised.Time); }
public void MessageRoundTrip() { const string name = "harry"; var original = new RequestPathMessage(name); var serialiser = new MessageSerialiser(); serialiser.Register(typeof(RequestPathMessage)); var text = serialiser.Serialise(original); var deserialised = (RequestPathMessage)serialiser.Deserialise(text); Assert.NotNull(deserialised); Assert.AreEqual(name, deserialised.Name); }