Пример #1
0
        public void TestRunAction()
        {
            var id = Guid.NewGuid();

            _grid1.GetCompute().Run(new ComputeAction(id));
            Assert.AreEqual(1, ComputeAction.InvokeCount(id));

            id = Guid.NewGuid();
            _grid1.GetCompute().RunAsync(new ComputeAction(id)).Wait();
            Assert.AreEqual(1, ComputeAction.InvokeCount(id));
        }
Пример #2
0
        public void TestBroadcastAction()
        {
            var id = Guid.NewGuid();

            _grid1.GetCompute().Broadcast(new ComputeAction(id));
            Assert.AreEqual(2, ComputeAction.InvokeCount(id));

            id = Guid.NewGuid();
            _grid1.GetCompute().BroadcastAsync(new ComputeAction(id)).Wait();
            Assert.AreEqual(2, ComputeAction.InvokeCount(id));
        }
Пример #3
0
        public void TestRunActions()
        {
            var id = Guid.NewGuid();

            _grid1.GetCompute().Run(Enumerable.Range(0, 10).Select(x => new ComputeAction(id)));
            Assert.AreEqual(10, ComputeAction.InvokeCount(id));

            var id2 = Guid.NewGuid();

            _grid1.GetCompute().RunAsync(Enumerable.Range(0, 10).Select(x => new ComputeAction(id2))).Wait();
            Assert.AreEqual(10, ComputeAction.InvokeCount(id2));
        }