Exemplo n.º 1
0
    public void AppStartupDoesNotEmitEvents()
    {
        var res = Some.EventStatusResponse() with {
            Status = Some.EventStatusListWithoutAnythingAdded()
        };

        A.CallTo(() => EventStatusClient.GetEventStatus()).Returns(res);

        var monitor = CreateMatchDayStatusMonitor();

        monitor.EveryFiveMinutesTick(CancellationToken.None);

        Assert.Empty(Mediator.PublishedMessages);
    }
Exemplo n.º 2
0
        public void AppStartupDoesNotEmitEvents()
        {
            var res = Some.EventStatusResponse() with {
                Status = Some.EventStatusListWithoutAnythingAdded()
            };

            A.CallTo(() => EventStatusClient.GetEventStatus()).Returns(res);

            var monitor = CreateMatchDayStatusMonitor();

            monitor.EveryFiveMinutesTick(CancellationToken.None);

            A.CallTo(() => Mediator.Publish(A <object> ._, A <CancellationToken> ._)).MustNotHaveHappened();
        }
Exemplo n.º 3
0
        public void NextCheck_BonusTrue_EmitsBonusAdded()
        {
            var res = Some.EventStatusResponse() with {
                Status = Some.EventStatusListWithoutAnythingAdded()
            };
            var res2 = Some.EventStatusResponse() with {
                Status = Some.EventStatusListBonusTrue()
            };

            A.CallTo(() => EventStatusClient.GetEventStatus()).Returns(value: res).Once().Then.Returns(res2);

            var monitor = CreateMatchDayStatusMonitor();

            monitor.EveryFiveMinutesTick(CancellationToken.None);
            monitor.EveryFiveMinutesTick(CancellationToken.None);

            A.CallTo(() => Mediator.Publish(A <BonusAdded> ._, CancellationToken.None)).MustHaveHappenedOnceExactly();
        }
Exemplo n.º 4
0
    public void NextCheck_BonusTrue_EmitsBonusAdded()
    {
        var res = Some.EventStatusResponse() with {
            Status = Some.EventStatusListWithoutAnythingAdded()
        };
        var res2 = Some.EventStatusResponse() with {
            Status = Some.EventStatusListBonusTrue()
        };

        A.CallTo(() => EventStatusClient.GetEventStatus()).Returns(value: res).Once().Then.Returns(res2);

        var monitor = CreateMatchDayStatusMonitor();

        monitor.EveryFiveMinutesTick(CancellationToken.None);
        monitor.EveryFiveMinutesTick(CancellationToken.None);

        Assert.Single(Mediator.PublishedMessages);
        Assert.IsType <MatchdayBonusPointsAdded>(Mediator.PublishedMessages[0].Message);
    }
Exemplo n.º 5
0
        public void NextCheck_PointsReady_EmitsPointsReady()
        {
            var first = Some.EventStatusResponse() with {
                Status = Some.EventStatusListWithoutAnythingAdded()
            };
            var then = Some.EventStatusResponse() with {
                Status = Some.EventStatusListPointsReady()
            };


            A.CallTo(() => EventStatusClient.GetEventStatus()).Returns(first).Once().Then.Returns(then);

            var monitor = CreateMatchDayStatusMonitor();

            monitor.EveryFiveMinutesTick(CancellationToken.None);
            monitor.EveryFiveMinutesTick(CancellationToken.None);

            A.CallTo(() => Mediator.Publish(A <PointsReady> ._, CancellationToken.None)).MustHaveHappenedOnceExactly();
        }
Exemplo n.º 6
0
    public void NextCheck_PointsReady_EmitsPointsReady()
    {
        var first = Some.EventStatusResponse() with {
            Status = Some.EventStatusListWithoutAnythingAdded()
        };
        var then = Some.EventStatusResponse() with {
            Status = Some.EventStatusListPointsReady()
        };


        A.CallTo(() => EventStatusClient.GetEventStatus()).Returns(first).Once().Then.Returns(then);

        var monitor = CreateMatchDayStatusMonitor();

        monitor.EveryFiveMinutesTick(CancellationToken.None);
        monitor.EveryFiveMinutesTick(CancellationToken.None);

        Assert.Single(Mediator.PublishedMessages);
        Assert.IsType <MatchdayMatchPointsAdded>(Mediator.PublishedMessages[0].Message);
    }