示例#1
0
        public void PickWinnerWhenTheCloseDateHasNotPassed()
        {
            // Arrange
            Competition competition = Stubs.StubCompetition(includeCorrectAnswers: false);

            competition.ClosingDate = DateTime.Now.AddMonths(1); // always ensure the data is in the future

            var competitionState = new OpenState();
            WinnerSelectedEvent winnerSelectedEvent = null;

            DomainEvents.Register <WinnerSelectedEvent>(evt => winnerSelectedEvent = evt);

            // Act
            competitionState.PickWinner(competition);

            // Assert
            Assert.IsNull(winnerSelectedEvent);
            Assert.AreEqual(CompetitionStatus.Open, competition.State.Status);
        }