public void ShouldRegisterDomainSyncAPI() { var domainSync = new DomainSync(); localServiceMock.VerifySet(ls => ls["serverSync.getDoR"] = It.IsAny <Delegate>()); localServiceMock.VerifySet(ls => ls["serverSync.getDoI"] = It.IsAny <Delegate>()); localServiceMock.VerifySet(ls => ls["serverSync.updateDoI"] = It.IsAny <Delegate>()); localServiceMock.VerifySet(ls => ls["serverSync.updateDoR"] = It.IsAny <Delegate>()); }
public void ShouldSendDoIUpdates() { serializationMock.Setup(s => s.SerializeObject <IDomainOfInterest>(doiMock.Object)) .Returns("serializedTestDoI"); var domainSync = new DomainSync(); domainSync.HandleLocalDoIChanged(this, new EventArgs()); handlers.Verify(h => h.UpdateDoI("serializedTestDoI"), Times.Once()); }
public void ShouldSendDoRUpdates() { serializationMock.Setup(s => s.SerializeObject <IDomainOfResponsibility>(dorMock.Object)) .Returns("serializedTestDoR"); var domainSync = new DomainSync(); domainSync.HandleLocalDoRChanged(this, new EventArgs()); handlers.Verify(h => h.UpdateDoR("serializedTestDoR"), Times.Once()); }
public void ShouldChangeRemoteDoROnUpdate() { var remoteDoRMock = new Mock <IDomainOfResponsibility>(); serializationMock.Setup(s => s.DeserializeObject <IDomainOfResponsibility>("serializedTestDoR")) .Returns(remoteDoRMock.Object); var domainSync = new DomainSync(); domainSync.HandleRemoteDoRChanged(remoteConnectionMock.Object, "serializedTestDoR"); Assert.AreSame(remoteServer.DoR, remoteDoRMock.Object); }
/// <summary> /// Initializes the object of this class. We have chosen to use this method instead of a constructor as various /// other methods called from Initilize require a ServerSync.Instance to be set, which requires a construct to /// have finished constructing the object already. /// </summary> public void Initialize() { localServer = new LocalServerImpl(); remoteServers = new Dictionary <Connection, IRemoteServer>(); domainSync = new DomainSync(); worldSync = new WorldSync(); componentSync = new ComponentSync(); localServer.Service.OnNewClient += HandleNewServerConnected; ConnectToRemoteServers(); PluginManager.Instance.AddPluginLoadedHandler("Terminal", RegisterTerminalCommands); }
/// <summary> /// Initializes the object of this class. We have chosen to use this method instead of a constructor as various /// other methods called from Initilize require a ServerSync.Instance to be set, which requires a construct to /// have finished constructing the object already. /// </summary> public void Initialize() { localServer = new LocalServerImpl(); remoteServers = new Dictionary <Connection, IRemoteServer>(); AttemptedConnections = new HashSet <Connection>(); domainSync = new DomainSync(); worldSync = new WorldSync(); componentSync = new ComponentSync(); localServer.Service.OnNewClient += HandleNewServerConnected; if (ServerDiscovery == null) { ServerDiscovery = new ConfigDiscovery(); } ConnectToRemoteServers(); PluginManager.Instance.AddPluginLoadedHandler("Terminal", RegisterTerminalCommands); }
/// <summary> /// Initializes the object of this class. We have chosen to use this method instead of a constructor as various /// other methods called from Initilize require a ServerSync.Instance to be set, which requires a construct to /// have finished constructing the object already. /// </summary> public void Initialize() { localServer = new LocalServerImpl(); remoteServers = new Dictionary<Connection, IRemoteServer>(); domainSync = new DomainSync(); worldSync = new WorldSync(); componentSync = new ComponentSync(); localServer.Service.OnNewClient += HandleNewServerConnected; ConnectToRemoteServers(); PluginManager.Instance.AddPluginLoadedHandler("Terminal", RegisterTerminalCommands); }
public void ShouldSendDoRUpdates() { serializationMock.Setup(s => s.SerializeObject<IDomainOfResponsibility>(dorMock.Object)) .Returns("serializedTestDoR"); var domainSync = new DomainSync(); domainSync.HandleLocalDoRChanged(this, new EventArgs()); handlers.Verify(h => h.UpdateDoR("serializedTestDoR"), Times.Once()); }
public void ShouldSendDoIUpdates() { serializationMock.Setup(s => s.SerializeObject<IDomainOfInterest>(doiMock.Object)) .Returns("serializedTestDoI"); var domainSync = new DomainSync(); domainSync.HandleLocalDoIChanged(this, new EventArgs()); handlers.Verify(h => h.UpdateDoI("serializedTestDoI"), Times.Once()); }
public void ShouldRegisterDomainSyncAPI() { var domainSync = new DomainSync(); localServiceMock.VerifySet(ls => ls["serverSync.getDoR"] = It.IsAny<Delegate>()); localServiceMock.VerifySet(ls => ls["serverSync.getDoI"] = It.IsAny<Delegate>()); localServiceMock.VerifySet(ls => ls["serverSync.updateDoI"] = It.IsAny<Delegate>()); localServiceMock.VerifySet(ls => ls["serverSync.updateDoR"] = It.IsAny<Delegate>()); }
public void ShouldChangeRemoteDoROnUpdate() { var remoteDoRMock = new Mock<IDomainOfResponsibility>(); serializationMock.Setup(s => s.DeserializeObject<IDomainOfResponsibility>("serializedTestDoR")) .Returns(remoteDoRMock.Object); var domainSync = new DomainSync(); domainSync.HandleRemoteDoRChanged(remoteConnectionMock.Object, "serializedTestDoR"); Assert.AreSame(remoteServer.DoR, remoteDoRMock.Object); }