public void MulticastRemoteSubscriptionHandleDeserializedAsRemoteSubscriptionHandle() { RemoteSubscriptionHandle h1 = new RemoteSubscriptionHandle { EventID = 1, SubscriberId = 2, PublisherId = 3, PublisherNodeID = 15, SubscriberNodeID = 1, SubscriptionReference = 35 }; MulticastRemoteSubscriptionhandle h2 = new MulticastRemoteSubscriptionhandle { EventID = 2, SubscriberId = 3, PublisherId = 1, PublisherNodeID = 13, SubscriberNodeID = 4, SubscriptionReference = 30, IpAddress = "228.4.0.1", Port = 44550 }; List <RemoteSubscriptionHandle> list = new List <RemoteSubscriptionHandle>(); list.Add(h1); list.Add(h2); byte [] serialized = Ella.Internal.Serializer.Serialize(list); List <RemoteSubscriptionHandle> list2 = Ella.Internal.Serializer.Deserialize <List <RemoteSubscriptionHandle> >(serialized); Assert.IsInstanceOfType(list2[1], typeof(MulticastRemoteSubscriptionhandle)); }
public void FakeNetworkControllerConnectToMulticastGroup() { FakeNetworkController nc = new FakeNetworkController(); Networking.NetworkController = nc; Networking.Start(); MulticastRemoteSubscriptionhandle h = new MulticastRemoteSubscriptionhandle(); Networking.ConnectToMulticast(h.IpAddress, h.Port); TestSubscriber s = new TestSubscriber(); s.Subscribe(); Assert.IsTrue(FakeNetworkController.connectedToMulticastgroup); }
public void NetworkControllerConnectToMulticastGroup() { NetworkController nc = new NetworkController(); FakeServer server = new FakeServer(); FakeSender sender = new FakeSender(); nc.Servers.Add(server); Networking.NetworkController = nc; Networking.Start(); SenderBase.FactoryMethod = e => sender; MulticastRemoteSubscriptionhandle h = new MulticastRemoteSubscriptionhandle(); Networking.ConnectToMulticast(h.IpAddress, h.Port); TestSubscriber s = new TestSubscriber(); s.Subscribe(); Assert.IsTrue(server._connectedToMulticastGroup); }