public async Task approve_submissions()
        {
            _actorProxyFactory.MissingActor += actorProxyFactory_MissingActor;
            ParticipantActor target = await CreateParticipantActor(ActorId.CreateRandom());

            var currentDate = DateTimeOffset.UtcNow;

            await target.AddActivity(new ParticipantActivity()
            {
                Points = 1, Date = currentDate
            });

            await target.AddEvent(new ParticipantEvent()
            {
                Id = Guid.NewGuid().ToString(), Points = 1, Date = currentDate
            });


            await target.SubmitForApproval(currentDate.Month, currentDate.Year);

            Assert.IsTrue(_messageDictionary.ContainsKey("recipient"));
        }
Ejemplo n.º 2
0
        public async Task validate_month_total_on_events_and_activities()
        {
            MockServiceProxyFactory serviceProxyFactory = new MockServiceProxyFactory();
            ParticipantActor        target = await CreateParticipantActor(ActorId.CreateRandom());

            var currentDate = DateTimeOffset.UtcNow;


            int monthChanger = -1;

            if (currentDate.Month == 1)
            {
                monthChanger = 1;
            }

            await target.AddEvent(new ParticipantEvent()
            {
                Id = Guid.NewGuid().ToString(), Points = 1, Date = currentDate.AddMonths(monthChanger)
            });

            await target.AddEvent(new ParticipantEvent()
            {
                Id = Guid.NewGuid().ToString(), Points = 1, Date = currentDate
            });

            await target.AddActivity(new ParticipantActivity()
            {
                Points = 1, Date = currentDate
            });

            var current = await target.StateManager.GetStateAsync <Participations>(ParticipationsKeyName);

            var participations = await target.GetMonthParticipations(currentDate.Month, currentDate.Year);

            Assert.AreEqual(2, participations.MonthTotalPoints);
        }