<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GridDomain.CQRS.Messaging;
using GridDomain.Node;
using GridDomain.Node.Configuration.Akka;
using GridDomain.Node.Configuration.Persistence;
using GridDomain.Tests.Framework;
using GridDomain.Tests.Framework.Configuration;
using GridDomain.Tests.FutureEvents.Infrastructure;
using Microsoft.Practices.Unity;
using NUnit.Framework;

namespace GridDomain.Tests.FutureEvents
{
    [TestFixture]
    class FutureEventsTests : NodeCommandsTest
    {
        public FutureEventsTests()
            : base(new AutoTestAkkaConfiguration().ToStandAloneInMemorySystemConfig(), "testSystem", false)
        {
        }

        protected override TimeSpan Timeout => TimeSpan.FromSeconds(2);
        protected override GridDomainNode CreateGridDomainNode(AkkaConfiguration akkaConf, IDbConfiguration dbConfig)
        {
            var container = new UnityContainer();
            container.RegisterAggregate<TestAggregate, TestAggregatesCommandHandler>();
            return new GridDomainNode(container, new TestRouteMap(), TransportMode.Standalone, Sys);
        }


        [Test]
        void Given_aggregate_When_raising_future_event_Then_it_fires_in_time()
        {
            var scheduledTime = DateTime.Now.AddSeconds(0.5);
            var msg = ExecuteAndWaitFor<TestDomainEvent>(new TestCommand(scheduledTime, Guid.NewGuid()));

            Assert.AreEqual(scheduledTime.Second, ((TestDomainEvent)msg.Message).processedTime.Second);
        }

        [Test]
        void Given_aggregate_When_raising_future_event_inpast_Then_it_fires_immidiatly()
        {
            throw new NotImplementedException();
        }

        [Test]
        void Given_aggregate_When_raising_future_event_Then_it_fires_after_node_restart()
        {<commit_msg>future events test runnable by NUnit<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GridDomain.CQRS.Messaging;
using GridDomain.Node;
using GridDomain.Node.Configuration.Akka;
using GridDomain.Node.Configuration.Persistence;
using GridDomain.Tests.Framework;
using GridDomain.Tests.Framework.Configuration;
using GridDomain.Tests.FutureEvents.Infrastructure;
using Microsoft.Practices.Unity;
using NUnit.Framework;

namespace GridDomain.Tests.FutureEvents
{
    [TestFixture]
    public class FutureEventsTests : NodeCommandsTest
    {
        public FutureEventsTests()
            : base(new AutoTestAkkaConfiguration().ToStandAloneInMemorySystemConfig(), "testSystem", false)
        {
        }

        protected override TimeSpan Timeout => TimeSpan.FromSeconds(2);
        protected override GridDomainNode CreateGridDomainNode(AkkaConfiguration akkaConf, IDbConfiguration dbConfig)
        {
            var container = new UnityContainer();
            container.RegisterAggregate<TestAggregate, TestAggregatesCommandHandler>();
            return new GridDomainNode(container, new TestRouteMap(), TransportMode.Standalone, Sys);
        }


        [Test]
        public void Given_aggregate_When_raising_future_event_Then_it_fires_in_time()
        {
            var scheduledTime = DateTime.Now.AddSeconds(0.5);
            var msg = ExecuteAndWaitFor<TestDomainEvent>(new TestCommand(scheduledTime, Guid.NewGuid()));

            Assert.AreEqual(scheduledTime.Second, ((TestDomainEvent)msg.Message).processedTime.Second);
        }

        [Test]
        public void Given_aggregate_When_raising_future_event_inpast_Then_it_fires_immidiatly()
        {
            throw new NotImplementedException();
        }

        [Test]
        public void Given_aggregate_When_raising_future_event_Then_it_fires_after_node_restart()
        {
{'fraction_non_alphanumeric': 0.07847240387130526, 'fraction_numerical': 0.0015694480774261052, 'mean_word_length': 3.6862745098039214, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '6957664', 'n_tokens_mistral': 1055, 'n_tokens_neox': 1024, 'n_words': 183}