public void RemoteExecuteTest() { using (RemoteServiceTester.Instance.GetToken()) { RemoteServiceTester.Instance.EnsureRunning(); var c = RemoteServiceHelper.CreateObject <ICancelableDelay>(Jhu.Graywulf.Test.Constants.Localhost); c.Execute(); Assert.IsFalse(c.IsCanceled); } }
public void SessionTest() { using (RemoteServiceTester.Instance.GetToken()) { RemoteServiceTester.Instance.EnsureRunning(); var c1 = RemoteServiceHelper.CreateObject <ICancelableDelay>(Jhu.Graywulf.Test.Constants.Localhost); var c2 = RemoteServiceHelper.CreateObject <ICancelableDelay>(Jhu.Graywulf.Test.Constants.Localhost); c2.Period = 2; c1.Period = 1; Assert.AreEqual(1, c1.Period); Assert.AreEqual(2, c2.Period); } }
public void QueryRegisteredServicesTest() { using (RemoteServiceTester.Instance.GetExclusiveToken()) { // Make sure it's restarted RemoteServiceTester.Instance.EnsureRunning(); RemoteServiceTester.Instance.Stop(); RemoteServiceTester.Instance.EnsureRunning(); var delay = RemoteServiceHelper.CreateObject <ICancelableDelay>(Jhu.Graywulf.Test.Constants.Localhost); var sc = RemoteServiceHelper.GetControlObject(Jhu.Graywulf.Test.Constants.Localhost); var ss = sc.QueryRegisteredServices(); Assert.AreEqual(1, ss.Length); } }
public void CancelRemoteExecuteTest() { using (RemoteServiceTester.Instance.GetToken()) { RemoteServiceTester.Instance.EnsureRunning(); var c = RemoteServiceHelper.CreateObject <ICancelableDelay>(Jhu.Graywulf.Test.Constants.Localhost); c.Period = 10000; var start = DateTime.Now; c.BeginExecute(); System.Threading.Thread.Sleep(1000); c.Cancel(); c.EndExecute(); Assert.IsTrue((DateTime.Now - start).TotalMilliseconds < 5000); Assert.IsTrue(c.IsCanceled); } }