示例#1
0
        public async Task Test_Reminders_Basic_StopByRef()
        {
            log.Info(TestContext.TestName);
            IReminderTestGrain2 grain = GrainClient.GrainFactory.GetGrain <IReminderTestGrain2>(Guid.NewGuid());

            IGrainReminder r1 = await grain.StartReminder(DR);

            IGrainReminder r2 = await grain.StartReminder(DR);

            try
            {
                // First handle should now be out of date once the seconf handle to the same reminder was obtained
                await grain.StopReminder(r1);

                Assert.Fail("Removed reminder1, which shouldn't be possible.");
            }
            catch (Exception exc)
            {
                log.Info("Couldn't remove {0}, as expected. Exception received = {1}", r1, exc);
            }

            await grain.StopReminder(r2);

            log.Info("Removed reminder2 successfully");

            // trying to see if readreminder works
            IGrainReminder o1 = await grain.StartReminder(DR);

            IGrainReminder o2 = await grain.StartReminder(DR);

            IGrainReminder o3 = await grain.StartReminder(DR);

            IGrainReminder o4 = await grain.StartReminder(DR);

            IGrainReminder r = await grain.GetReminderObject(DR);

            await grain.StopReminder(r);

            log.Info("Removed got reminder successfully");
        }
示例#2
0
        public async Task Test_Reminders_Basic_StopByRef()
        {
            IReminderTestGrain2 grain = this.GrainFactory.GetGrain <IReminderTestGrain2>(Guid.NewGuid());

            IGrainReminder r1 = await grain.StartReminder(DR);

            IGrainReminder r2 = await grain.StartReminder(DR);

            try
            {
                // First handle should now be out of date once the seconf handle to the same reminder was obtained
                await grain.StopReminder(r1);

                Assert.True(false, "Removed reminder1, which shouldn't be possible.");
            }
            catch (Exception exc)
            {
                log.LogInformation(exc, "Couldn't remove {Reminder}, as expected.", r1);
            }

            await grain.StopReminder(r2);

            log.LogInformation("Removed reminder2 successfully");

            // trying to see if readreminder works
            _ = await grain.StartReminder(DR);

            _ = await grain.StartReminder(DR);

            _ = await grain.StartReminder(DR);

            _ = await grain.StartReminder(DR);

            IGrainReminder r = await grain.GetReminderObject(DR);

            await grain.StopReminder(r);

            log.LogInformation("Removed got reminder successfully");
        }
示例#3
0
        public async Task Test_Reminders_Basic_StopByRef()
        {
            IReminderTestGrain2 grain = GrainClient.GrainFactory.GetGrain <IReminderTestGrain2>(Guid.NewGuid());

            IGrainReminder r1 = await grain.StartReminder(DR, TimeSpan.FromSeconds(10));

            IGrainReminder r2 = await grain.StartReminder(DR);

            try
            {
                // First handle should now be out of date once the seconf handle to the same reminder was obtained
                await grain.StopReminder(r1);

                Assert.IsTrue(false, "Removed reminder1, which shouldn't be possible.");
            }
            catch (Exception exc)
            {
                if (this.log != null)
                {
                    log.Info("Couldn't remove {0}, as expected. Exception received = {1}", r1, exc);
                }
            }

            await grain.StopReminder(r2);

            // trying to see if readreminder works
            IGrainReminder o1 = await grain.StartReminder(DR);

            IGrainReminder o2 = await grain.StartReminder(DR);

            IGrainReminder o3 = await grain.StartReminder(DR);

            IGrainReminder o4 = await grain.StartReminder(DR);

            IGrainReminder r = await grain.GetReminderObject(DR);

            await grain.StopReminder(r);
        }