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); }
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(); }
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(); }
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); }
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(); }
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); }