示例#1
0
        public async Task ObserverTest_DoubleSubscriptionDifferentReferences()
        {
            TestInitialize();
            var result = new AsyncResultHandle();

            ISimpleObserverableGrain grain = GetGrain();

            this.observer1 = new SimpleGrainObserver(this.ObserverTest_DoubleSubscriptionDifferentReferences_Callback, result, this.Logger);
            ISimpleGrainObserver reference1 = await this.GrainFactory.CreateObjectReference <ISimpleGrainObserver>(observer1);

            this.observer2 = new SimpleGrainObserver(this.ObserverTest_DoubleSubscriptionDifferentReferences_Callback, result, this.Logger);
            ISimpleGrainObserver reference2 = await this.GrainFactory.CreateObjectReference <ISimpleGrainObserver>(observer2);

            await grain.Subscribe(reference1);

            await grain.Subscribe(reference2);

            grain.SetA(6).Ignore();

            Assert.True(await result.WaitForFinished(timeout), string.Format("Should not timeout waiting {0} for SetA", timeout));

            await this.GrainFactory.DeleteObjectReference <ISimpleGrainObserver>(reference1);

            await this.GrainFactory.DeleteObjectReference <ISimpleGrainObserver>(reference2);
        }
示例#2
0
        public async Task ObserverTest_Unsubscribe()
        {
            TestInitialize();
            ISimpleObserverableGrain grain = GetGrain();

            this.observer1 = new SimpleGrainObserver(null, null, this.Logger);
            ISimpleGrainObserver reference = await this.GrainFactory.CreateObjectReference <ISimpleGrainObserver>(observer1);

            try
            {
                await grain.Unsubscribe(reference);

                await this.GrainFactory.DeleteObjectReference <ISimpleGrainObserver>(reference);
            }
            catch (TimeoutException)
            {
                throw;
            }
            catch (Exception exc)
            {
                Exception baseException = exc.GetBaseException();
                if (!(baseException is OrleansException))
                {
                    Assert.True(false);
                }
            }
        }
示例#3
0
        public async Task ObserverTest_Unsubscribe()
        {
            ISimpleObserverableGrain grain = GetGrain();

            this.observer1 = new SimpleGrainObserver(null, null);
            ISimpleGrainObserver reference = await SimpleGrainObserverFactory.CreateObjectReference(this.observer1);

            try
            {
                bool ok = grain.Unsubscribe(reference).Wait(timeout);
                if (!ok)
                {
                    throw new TimeoutException();
                }

                await SimpleGrainObserverFactory.DeleteObjectReference(reference);
            }
            catch (TimeoutException)
            {
                throw;
            }
            catch (Exception exc)
            {
                Exception baseException = exc.GetBaseException();
                if (!(baseException is OrleansException))
                {
                    Assert.Fail("Unexpected exception type {0}", baseException);
                }
            }
        }
示例#4
0
        private void TestInitialize()
        {
            callbackCounter      = 0;
            callbacksRecieved[0] = false;
            callbacksRecieved[1] = false;

            observer1 = null;
            observer2 = null;
        }
示例#5
0
        public void TestInitialize()
        {
            callbackCounter      = 0;
            callbacksRecieved[0] = false;
            callbacksRecieved[1] = false;

            this.observer1 = null;
            this.observer2 = null;
        }
示例#6
0
        public void TestInitialize()
        {
            callbackCounter = 0;
            callbacksRecieved[0] = false;
            callbacksRecieved[1] = false;

            observer1 = null;
            observer2 = null;
        }
示例#7
0
        public async Task ObserverTest_SubscriberMustBeGrainReference()
        {
            var result = new AsyncResultHandle();

            ISimpleObserverableGrain grain = GetGrain();

            observer1 = new SimpleGrainObserver(ObserverTest_SimpleNotification_Callback, result);
            ISimpleGrainObserver reference = observer1;
            // Should be: GrainFactory.CreateObjectReference<ISimpleGrainObserver>(obj);
            await grain.Subscribe(reference);

            // Not reached
        }
示例#8
0
        public void ObserverTest_SubscriberMustBeGrainReference()
        {
            ResultHandle result = new ResultHandle();

            ISimpleObserverableGrain grain = GetGrain();

            this.observer1 = new SimpleGrainObserver(ObserverTest_SimpleNotification_Callback, result);
            ISimpleGrainObserver reference = this.observer1;

            // Should be: SimpleGrainObserverFactory.CreateObjectReference(obj);
            grain.Subscribe(reference).Wait();
            // Not reached
        }
示例#9
0
        public async Task ObserverTest_SubscriberMustBeGrainReference()
        {
            TestInitialize();
            await Xunit.Assert.ThrowsAsync(typeof(NotSupportedException), async() =>
            {
                var result = new AsyncResultHandle();

                ISimpleObserverableGrain grain = GetGrain();
                observer1 = new SimpleGrainObserver(ObserverTest_SimpleNotification_Callback, result);
                ISimpleGrainObserver reference = observer1;
                // Should be: GrainFactory.CreateObjectReference<ISimpleGrainObserver>(obj);
                await grain.Subscribe(reference);
                // Not reached
            });
        }
示例#10
0
        public async Task ObserverTest_SubscriberMustBeGrainReference()
        {
            TestInitialize();
            await Assert.ThrowsAsync <NotSupportedException>(async() =>
            {
                var result = new AsyncResultHandle();

                ISimpleObserverableGrain grain = this.GetGrain();
                this.observer1 = new SimpleGrainObserver(this.ObserverTest_SimpleNotification_Callback, result, this.Logger);
                ISimpleGrainObserver reference = this.observer1;
                // Should be: this.GrainFactory.CreateObjectReference<ISimpleGrainObserver>(obj);
                await grain.Subscribe(reference);
                // Not reached
            });
        }
示例#11
0
        public async Task ObserverTest_SimpleNotification_GeneratedFactory()
        {
            var result = new AsyncResultHandle();

            ISimpleObserverableGrain grain = GetGrain();
            observer1 = new SimpleGrainObserver(ObserverTest_SimpleNotification_Callback, result);
            ISimpleGrainObserver reference = await GrainFactory.CreateObjectReference<ISimpleGrainObserver>(observer1);
            await grain.Subscribe(reference);
            await grain.SetA(3);
            await grain.SetB(2);

            Assert.IsTrue(await result.WaitForFinished(timeout), "Should not timeout waiting {0} for {1}", timeout, "SetB");

            await GrainFactory.DeleteObjectReference<ISimpleGrainObserver>(reference);
        }
示例#12
0
        public async Task OneWayMethodReturnSynchronously_ViaGrain_ValueTask()
        {
            var grain      = this.Client.GetGrain <IOneWayGrain>(Guid.NewGuid());
            var otherGrain = this.Client.GetGrain <IOneWayGrain>(Guid.NewGuid());

            var observer               = new SimpleGrainObserver();
            var observerReference      = this.Client.CreateObjectReference <ISimpleGrainObserver>(observer);
            var completedSynchronously = await grain.NotifyOtherGrainValueTask(otherGrain, observerReference);

            Assert.True(completedSynchronously, "Task should be synchronously completed.");
            await observer.ReceivedValue.WithTimeout(TimeSpan.FromSeconds(10));

            var count = await otherGrain.GetCount();

            Assert.Equal(1, count);
        }
示例#13
0
        public async Task ObserverTest_SimpleNotification()
        {
            TestInitialize();
            var result = new AsyncResultHandle();

            ISimpleObserverableGrain grain = GetGrain();
            observer1 = new SimpleGrainObserver(ObserverTest_SimpleNotification_Callback, result);
            ISimpleGrainObserver reference = await GrainFactory.CreateObjectReference<ISimpleGrainObserver>(this.observer1);
            await grain.Subscribe(reference);
            await grain.SetA(3);
            await grain.SetB(2);

            Assert.True(await result.WaitForFinished(timeout));

            await GrainFactory.DeleteObjectReference<ISimpleGrainObserver>(reference);
        }
示例#14
0
        public async Task ObserverTest_SimpleNotification()
        {
            ResultHandle result = new ResultHandle();

            ISimpleObserverableGrain grain = GetGrain();

            this.observer1 = new SimpleGrainObserver(ObserverTest_SimpleNotification_Callback, result);
            ISimpleGrainObserver reference = await SimpleGrainObserverFactory.CreateObjectReference(this.observer1);

            grain.Subscribe(reference).Wait();
            grain.SetA(3).Wait();
            grain.SetB(2).Wait();

            Assert.IsTrue(result.WaitForFinished(timeout), "Should not timeout waiting {0} for {1}", timeout, "SetB");

            await SimpleGrainObserverFactory.DeleteObjectReference(reference);
        }
示例#15
0
        public async Task OneWayMethodsReturnSynchronously()
        {
            var grain = this.Client.GetGrain <IOneWayGrain>(Guid.NewGuid());

            var observer = new SimpleGrainObserver();
            var task     = grain.Notify(await this.Client.CreateObjectReference <ISimpleGrainObserver>(observer));

            Assert.True(task.Status == TaskStatus.RanToCompletion, "Task should be synchronously completed.");
            await observer.ReceivedValue;
            var count = await grain.GetCount();

            Assert.Equal(1, count);

            // This should not throw.
            task = grain.ThrowsOneWay();
            Assert.True(task.Status == TaskStatus.RanToCompletion, "Task should be synchronously completed.");
        }
示例#16
0
        public async Task OneWayMethodsReturnSynchronously_ViaClient_ValueTask()
        {
            var grain = this.Client.GetGrain <IOneWayGrain>(Guid.NewGuid());

            var observer = new SimpleGrainObserver();
            var task     = grain.NotifyValueTask(this.Client.CreateObjectReference <ISimpleGrainObserver>(observer));

            Assert.True(task.IsCompleted, "ValueTask should be synchronously completed.");
            await observer.ReceivedValue.WithTimeout(TimeSpan.FromSeconds(10));

            var count = await grain.GetCount();

            Assert.Equal(1, count);

            // This should not throw.
            task = grain.ThrowsOneWayValueTask();
            Assert.True(task.IsCompleted, "Task should be synchronously completed.");
        }
示例#17
0
        public async Task ObserverTest_SimpleNotification_GeneratedFactory()
        {
            TestInitialize();
            var result = new AsyncResultHandle();

            ISimpleObserverableGrain grain = GetGrain();

            this.observer1 = new SimpleGrainObserver(this.ObserverTest_SimpleNotification_Callback, result, this.Logger);
            ISimpleGrainObserver reference = this.GrainFactory.CreateObjectReference <ISimpleGrainObserver>(observer1);
            await grain.Subscribe(reference);

            await grain.SetA(3);

            await grain.SetB(2);

            Assert.True(await result.WaitForFinished(timeout));

            this.GrainFactory.DeleteObjectReference <ISimpleGrainObserver>(reference);
        }
示例#18
0
        public async Task ObserverTest_DeleteObject()
        {
            TestInitialize();
            var result = new AsyncResultHandle();

            ISimpleObserverableGrain grain = GetGrain();

            this.observer1 = new SimpleGrainObserver(this.ObserverTest_DeleteObject_Callback, result, this.Logger);
            ISimpleGrainObserver reference = this.GrainFactory.CreateObjectReference <ISimpleGrainObserver>(observer1);
            await grain.Subscribe(reference);

            await grain.SetA(5);

            Assert.True(await result.WaitForContinue(timeout), $"Should not timeout waiting {timeout} for SetA");
            this.GrainFactory.DeleteObjectReference <ISimpleGrainObserver>(reference);
            await grain.SetB(3);

            Assert.False(await result.WaitForFinished(timeout), $"Should timeout waiting {timeout} for SetB");
        }
示例#19
0
        public async Task ObserverTest_SimpleNotification_GeneratedFactory()
        {
            var result = new AsyncResultHandle();

            ISimpleObserverableGrain grain = GetGrain();

            observer1 = new SimpleGrainObserver(ObserverTest_SimpleNotification_Callback, result);
            ISimpleGrainObserver reference = await GrainFactory.CreateObjectReference <ISimpleGrainObserver>(observer1);

            await grain.Subscribe(reference);

            await grain.SetA(3);

            await grain.SetB(2);

            Assert.IsTrue(await result.WaitForFinished(timeout), "Should not timeout waiting {0} for {1}", timeout, "SetB");

            await GrainFactory.DeleteObjectReference <ISimpleGrainObserver>(reference);
        }
示例#20
0
        public async Task ObserverTest_DeleteObject()
        {
            var result = new AsyncResultHandle();

            ISimpleObserverableGrain grain = GetGrain();

            this.observer1 = new SimpleGrainObserver(ObserverTest_DeleteObject_Callback, result);
            ISimpleGrainObserver reference = await GrainFactory.CreateObjectReference <ISimpleGrainObserver>(this.observer1);

            await grain.Subscribe(reference);

            await grain.SetA(5);

            Assert.IsTrue(await result.WaitForContinue(timeout), "Should not timeout waiting {0} for {1}", timeout, "SetA");
            await GrainFactory.DeleteObjectReference <ISimpleGrainObserver>(reference);

            await grain.SetB(3);

            Assert.IsFalse(await result.WaitForFinished(timeout), "Should timeout waiting {0} for {1}", timeout, "SetB");
        }
示例#21
0
        public async Task ObserverTest_DoubleSubscriptionDifferentReferences()
        {
            ResultHandle result = new ResultHandle();

            ISimpleObserverableGrain grain = GetGrain();

            this.observer1 = new SimpleGrainObserver(ObserverTest_DoubleSubscriptionDifferentReferences_Callback, result);
            ISimpleGrainObserver reference1 = await SimpleGrainObserverFactory.CreateObjectReference(this.observer1);

            this.observer2 = new SimpleGrainObserver(ObserverTest_DoubleSubscriptionDifferentReferences_Callback, result);
            ISimpleGrainObserver reference2 = await SimpleGrainObserverFactory.CreateObjectReference(this.observer2);

            grain.Subscribe(reference1).Wait();
            grain.Subscribe(reference2).Wait();
            grain.SetA(6).Ignore();

            Assert.IsTrue(result.WaitForFinished(timeout), "Should not timeout waiting {0} for {1}", timeout, "SetA");

            await SimpleGrainObserverFactory.DeleteObjectReference(reference1);

            await SimpleGrainObserverFactory.DeleteObjectReference(reference2);
        }
示例#22
0
        public async Task ObserverTest_DoubleSubscriptionSameReference()
        {
            ResultHandle result = new ResultHandle();

            ISimpleObserverableGrain grain = GetGrain();

            this.observer1 = new SimpleGrainObserver(ObserverTest_DoubleSubscriptionSameReference_Callback, result);
            ISimpleGrainObserver reference = await SimpleGrainObserverFactory.CreateObjectReference(this.observer1);

            grain.Subscribe(reference).Wait();
            grain.SetA(1).Wait(); // Use grain
            try
            {
                bool ok = grain.Subscribe(reference).Wait(timeout);
                if (!ok)
                {
                    throw new TimeoutException();
                }
            }
            catch (TimeoutException)
            {
                throw;
            }
            catch (Exception exc)
            {
                Exception baseException = exc.GetBaseException();
                Console.WriteLine("Received exception: {0}", baseException);
                Assert.IsInstanceOfType(baseException, typeof(OrleansException));
                if (!baseException.Message.StartsWith("Cannot subscribe already subscribed observer"))
                {
                    Assert.Fail("Unexpected exception message: " + baseException);
                }
            }
            grain.SetA(2).Wait(); // Use grain

            Assert.IsFalse(result.WaitForFinished(timeout), "Should timeout waiting {0} for {1}", timeout, "SetA(2)");

            await SimpleGrainObserverFactory.DeleteObjectReference(reference);
        }
示例#23
0
        public async Task ObserverTest_DoubleSubscriptionSameReference()
        {
            TestInitialize();
            var result = new AsyncResultHandle();

            ISimpleObserverableGrain grain = GetGrain();

            this.observer1 = new SimpleGrainObserver(this.ObserverTest_DoubleSubscriptionSameReference_Callback, result, this.Logger);
            ISimpleGrainObserver reference = await this.GrainFactory.CreateObjectReference <ISimpleGrainObserver>(observer1);

            await grain.Subscribe(reference);

            await grain.SetA(1); // Use grain

            try
            {
                await grain.Subscribe(reference);
            }
            catch (TimeoutException)
            {
                throw;
            }
            catch (Exception exc)
            {
                Exception baseException = exc.GetBaseException();
                this.Logger.Info("Received exception: {0}", baseException);
                Assert.IsAssignableFrom <OrleansException>(baseException);
                if (!baseException.Message.StartsWith("Cannot subscribe already subscribed observer"))
                {
                    Assert.True(false, "Unexpected exception message: " + baseException);
                }
            }

            await grain.SetA(2); // Use grain

            Assert.False(await result.WaitForFinished(timeout), string.Format("Should timeout waiting {0} for SetA(2)", timeout));

            await this.GrainFactory.DeleteObjectReference <ISimpleGrainObserver>(reference);
        }
示例#24
0
        public async Task MethodsInvokedThroughOneWayExtensionReturnSynchronously()
        {
            var grain = this.Client.GetGrain <ICanBeOneWayGrain>(Guid.NewGuid());

            var observer    = new SimpleGrainObserver();
            var observerRef = await Client.CreateObjectReference <ISimpleGrainObserver>(observer);

            grain.InvokeOneWay(g =>
            {
                Assert.False(object.ReferenceEquals(g, grain), "One way call should be executed on copy of grain reference");
                Assert.Equal(g, grain);
                return(g.Notify(observerRef));
            });

            await observer.ReceivedValue;
            var count = await grain.GetCount();

            Assert.Equal(1, count);

            // This should not throw.
            grain.InvokeOneWay(g => g.Throws());
        }
示例#25
0
        public async Task ObserverTest_DoubleSubscriptionSameReference()
        {
            TestInitialize();
            var result = new AsyncResultHandle();

            ISimpleObserverableGrain grain = GetGrain();

            observer1 = new SimpleGrainObserver(ObserverTest_DoubleSubscriptionSameReference_Callback, result);
            ISimpleGrainObserver reference = await GrainFactory.CreateObjectReference <ISimpleGrainObserver>(observer1);

            await grain.Subscribe(reference);

            await grain.SetA(1); // Use grain

            try
            {
                await grain.Subscribe(reference);
            }
            catch (TimeoutException)
            {
                throw;
            }
            catch (Exception exc)
            {
                Exception baseException = exc.GetBaseException();
                logger.Info("Received exception: {0}", baseException);
                Assert.IsInstanceOfType(baseException, typeof(OrleansException));
                if (!baseException.Message.StartsWith("Cannot subscribe already subscribed observer"))
                {
                    Assert.Fail("Unexpected exception message: " + baseException);
                }
            }
            await grain.SetA(2); // Use grain

            Assert.IsFalse(await result.WaitForFinished(timeout), "Should timeout waiting {0} for {1}", timeout, "SetA(2)");

            await GrainFactory.DeleteObjectReference <ISimpleGrainObserver>(reference);
        }
示例#26
0
        public async Task ObserverTest_SubscribeUnsubscribe()
        {
            TestInitialize();
            var result = new AsyncResultHandle();

            ISimpleObserverableGrain grain = GetGrain();

            observer1 = new SimpleGrainObserver(ObserverTest_SubscribeUnsubscribe_Callback, result);
            ISimpleGrainObserver reference = await GrainFactory.CreateObjectReference <ISimpleGrainObserver>(observer1);

            await grain.Subscribe(reference);

            await grain.SetA(5);

            Assert.True(await result.WaitForContinue(timeout), string.Format("Should not timeout waiting {0} for SetA", timeout));

            await grain.Unsubscribe(reference);

            await grain.SetB(3);

            Assert.False(await result.WaitForFinished(timeout), string.Format("Should timeout waiting {0} for SetB", timeout));

            await GrainFactory.DeleteObjectReference <ISimpleGrainObserver>(reference);
        }
示例#27
0
        public async Task ObserverTest_DoubleSubscriptionSameReference()
        {
            TestInitialize();
            var result = new AsyncResultHandle();

            ISimpleObserverableGrain grain = GetGrain();
            observer1 = new SimpleGrainObserver(ObserverTest_DoubleSubscriptionSameReference_Callback, result);
            ISimpleGrainObserver reference = await GrainFactory.CreateObjectReference<ISimpleGrainObserver>(observer1);
            await grain.Subscribe(reference);
            await grain.SetA(1); // Use grain
            try
            {
                await grain.Subscribe(reference);
            }
            catch (TimeoutException)
            {
                throw;
            }
            catch (Exception exc)
            {
                Exception baseException = exc.GetBaseException();
                logger.Info("Received exception: {0}", baseException);
                Assert.IsAssignableFrom<OrleansException>(baseException);
                if (!baseException.Message.StartsWith("Cannot subscribe already subscribed observer"))
                {
                    Assert.True(false, "Unexpected exception message: " + baseException);
                }
            }

            await grain.SetA(2); // Use grain

            Assert.False(await result.WaitForFinished(timeout), string.Format("Should timeout waiting {0} for SetA(2)", timeout));

            await GrainFactory.DeleteObjectReference<ISimpleGrainObserver>(reference);
        }
示例#28
0
        public async Task ObserverTest_Unsubscribe()
        {
            ISimpleObserverableGrain grain = GetGrain();
            observer1 = new SimpleGrainObserver(null, null);
            ISimpleGrainObserver reference = await GrainFactory.CreateObjectReference<ISimpleGrainObserver>(observer1);
            try
            {
                await grain.Unsubscribe(reference);

                await GrainFactory.DeleteObjectReference<ISimpleGrainObserver>(reference);
            }
            catch (TimeoutException)
            {
                throw;
            }
            catch (Exception exc)
            {
                Exception baseException = exc.GetBaseException();
                if (!(baseException is OrleansException))
                    Assert.Fail("Unexpected exception type {0}", baseException);
            }
        }
示例#29
0
        public async Task ObserverTest_DeleteObject()
        {
            TestInitialize();
            var result = new AsyncResultHandle();

            ISimpleObserverableGrain grain = GetGrain();
            observer1 = new SimpleGrainObserver(ObserverTest_DeleteObject_Callback, result);
            ISimpleGrainObserver reference = await GrainFactory.CreateObjectReference<ISimpleGrainObserver>(observer1);
            await grain.Subscribe(reference);
            await grain.SetA(5);
            Assert.True(await result.WaitForContinue(timeout), string.Format("Should not timeout waiting {0} for SetA", timeout));
            await GrainFactory.DeleteObjectReference<ISimpleGrainObserver>(reference);
            await grain.SetB(3);

            Assert.False(await result.WaitForFinished(timeout), string.Format("Should timeout waiting {0} for SetB", timeout));
        }
示例#30
0
        public async Task ObserverTest_SubscriberMustBeGrainReference()
        {
            var result = new AsyncResultHandle();

            ISimpleObserverableGrain grain = GetGrain();
            observer1 = new SimpleGrainObserver(ObserverTest_SimpleNotification_Callback, result);
            ISimpleGrainObserver reference = observer1;
            // Should be: GrainFactory.CreateObjectReference<ISimpleGrainObserver>(obj);
            await grain.Subscribe(reference);
            // Not reached
        }
示例#31
0
        public async Task ObserverTest_DoubleSubscriptionSameReference()
        {
            var result = new AsyncResultHandle();

            ISimpleObserverableGrain grain = GetGrain();
            observer1 = new SimpleGrainObserver(ObserverTest_DoubleSubscriptionSameReference_Callback, result);
            ISimpleGrainObserver reference = await GrainFactory.CreateObjectReference<ISimpleGrainObserver>(observer1);
            await grain.Subscribe(reference);
            await grain.SetA(1); // Use grain
            try
            {
                await grain.Subscribe(reference);
            }
            catch (TimeoutException)
            {
                throw;
            }
            catch (Exception exc)
            {
                Exception baseException = exc.GetBaseException();
                Console.WriteLine("Received exception: {0}", baseException);
                Assert.IsInstanceOfType(baseException, typeof(OrleansException));
                if (!baseException.Message.StartsWith("Cannot subscribe already subscribed observer"))
                {
                    Assert.Fail("Unexpected exception message: " + baseException);
                }
            }
            await grain.SetA(2); // Use grain

            Assert.IsFalse(await result.WaitForFinished(timeout), "Should timeout waiting {0} for {1}", timeout, "SetA(2)");

            await GrainFactory.DeleteObjectReference<ISimpleGrainObserver>(reference);
        }
示例#32
0
        public async Task ObserverTest_SubscriberMustBeGrainReference()
        {
            TestInitialize();
            await Xunit.Assert.ThrowsAsync(typeof(NotSupportedException), async () =>
            {
                var result = new AsyncResultHandle();

                ISimpleObserverableGrain grain = GetGrain();
                observer1 = new SimpleGrainObserver(ObserverTest_SimpleNotification_Callback, result);
                ISimpleGrainObserver reference = observer1;
                // Should be: GrainFactory.CreateObjectReference<ISimpleGrainObserver>(obj);
                await grain.Subscribe(reference);
                // Not reached
            });
        }
示例#33
0
        public async Task ObserverTest_DoubleSubscriptionDifferentReferences()
        {
            var result = new AsyncResultHandle();

            ISimpleObserverableGrain grain = GetGrain();
            observer1 = new SimpleGrainObserver(ObserverTest_DoubleSubscriptionDifferentReferences_Callback, result);
            ISimpleGrainObserver reference1 = await GrainFactory.CreateObjectReference<ISimpleGrainObserver>(observer1);
            observer2 = new SimpleGrainObserver(ObserverTest_DoubleSubscriptionDifferentReferences_Callback, result);
            ISimpleGrainObserver reference2 = await GrainFactory.CreateObjectReference<ISimpleGrainObserver>(observer2);
            await grain.Subscribe(reference1);
            await grain.Subscribe(reference2);
            grain.SetA(6).Ignore();

            Assert.IsTrue(await result.WaitForFinished(timeout), "Should not timeout waiting {0} for {1}", timeout, "SetA");

            await GrainFactory.DeleteObjectReference<ISimpleGrainObserver>(reference1);
            await GrainFactory.DeleteObjectReference<ISimpleGrainObserver>(reference2);
        }