예제 #1
0
        public async Task TriggerUnRegisterReminder()
        {
            // Arrange
            var grain = await Silo.CreateGrainAsync <HelloReminders>(0);

            const string reminderName = "abc123";
            var          due          = TimeSpan.Zero;
            var          period       = TimeSpan.MaxValue;
            await grain.RegisterReminder(reminderName, due, period);

            await grain.UnregisterReminder(reminderName);

            // Act
            await Silo.FireAllReminders();

            // Assert
            grain.FiredReminders.Count.Should().Be(0);
        }
예제 #2
0
        public async Task TriggerAllReminders()
        {
            // Arrange
            var grain = await Silo.CreateGrainAsync <HelloReminders>(0);

            const string reminderName1 = "abc123";
            const string reminderName2 = "123";

            await grain.RegisterReminder(reminderName1, TimeSpan.Zero, TimeSpan.MaxValue);

            await grain.RegisterReminder(reminderName2, TimeSpan.Zero, TimeSpan.MaxValue);

            // Act
            await Silo.FireAllReminders();

            // Assert
            grain.FiredReminders.Should().Contain(reminderName1);
            grain.FiredReminders.Should().Contain(reminderName2);
            grain.FiredReminders.Count.Should().Be(2);
        }