<commit_before>﻿using System;
using Akka.Actor;
using Akka.TestKit.NUnit;
using ForgetMeNot.Common;
using ForgetMeNot.Core.Schedule;
using ForgetMeNot.Messages;
using NUnit.Framework;
using FluentAssertions;

namespace ForgetMeNot.Core.Tests.SchedulerTests
{
    [TestFixture]
    public class WhenRemindersBecomeDue : TestKit
    {
        [Test]
        public void ThenDueMessagesAreSent()
        {
            var now = SystemTime.FreezeTime();
            var schedulerProps = Props.Create(() => new Scheduler(10, TestActor));
            var scheduler = ActorOf(schedulerProps, "scheduler");

            scheduler.Tell(new SystemMessage.Start());
            scheduler.Tell(TestHelper.BuildMeAScheduleMessage(now));
            scheduler.Tell(TestHelper.BuildMeAScheduleMessage(now));
            scheduler.Tell(TestHelper.BuildMeAScheduleMessage(now));
            scheduler.Tell(TestHelper.BuildMeAScheduleMessage(now));
            scheduler.Tell(TestHelper.BuildMeAScheduleMessage(now + 4.Minutes()));
            scheduler.Tell(TestHelper.BuildMeAScheduleMessage(now + 2.Hours()));

            SystemTime.Set(now + 1.Seconds());

            scheduler.Tell(new Scheduler.Messages.CheckQueue());

            ExpectMsg<ReminderMessage.Due>();
            ExpectMsg<ReminderMessage.Due>();
            ExpectMsg<ReminderMessage.Due>();
            ExpectMsg<ReminderMessage.Due>();      
      
            scheduler.Tell(new QueryMessage.HowBigIsYourQueue());

            ExpectMsg<QueryMessage.HowBigIsYourQueueResponse>(query => query.Size.Should().Be(2));
        }
    }<commit_msg>fixed due reminders test with UTC time<commit_after>﻿using System;
using Akka.Actor;
using Akka.TestKit.NUnit;
using ForgetMeNot.Common;
using ForgetMeNot.Core.Schedule;
using ForgetMeNot.Messages;
using NUnit.Framework;
using FluentAssertions;

namespace ForgetMeNot.Core.Tests.SchedulerTests
{
    [TestFixture]
    public class WhenRemindersBecomeDue : TestKit
    {
        [Test]
        public void ThenDueMessagesAreSent()
        {
            var now = SystemTime.FreezeTime().ToUniversalTime();
            var schedulerProps = Props.Create(() => new Scheduler(10, TestActor));
            var scheduler = ActorOf(schedulerProps, "scheduler");

            scheduler.Tell(new SystemMessage.Start());
            scheduler.Tell(TestHelper.BuildMeAScheduleMessage(now));
            scheduler.Tell(TestHelper.BuildMeAScheduleMessage(now));
            scheduler.Tell(TestHelper.BuildMeAScheduleMessage(now));
            scheduler.Tell(TestHelper.BuildMeAScheduleMessage(now));
            scheduler.Tell(TestHelper.BuildMeAScheduleMessage(now + 4.Minutes()));
            scheduler.Tell(TestHelper.BuildMeAScheduleMessage(now + 2.Hours()));

            SystemTime.Set(now + 1.Seconds());

            scheduler.Tell(new Scheduler.Messages.CheckQueue());

            ExpectMsg<ReminderMessage.Due>();
            ExpectMsg<ReminderMessage.Due>();
            ExpectMsg<ReminderMessage.Due>();
            ExpectMsg<ReminderMessage.Due>();      
      
            scheduler.Tell(new QueryMessage.HowBigIsYourQueue());

            ExpectMsg<QueryMessage.HowBigIsYourQueueResponse>(query => query.Size.Should().Be(2));
        }
    }
{'fraction_non_alphanumeric': 0.110699969164354, 'fraction_numerical': 0.0037002775208140612, 'mean_word_length': 2.9950738916256157, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '10553', 'n_tokens_mistral': 939, 'n_tokens_neox': 904, 'n_words': 130}