public void PreventJoining_GivenQuestionsBeingAsked() { var automatedActionSystem = new FakeActionSystem(); var mockRepo = new Mock <IRepository>(); var quizGame = new QuizGame(mockRepo.Object, new Mock <ICurrencyGenerator>().Object, automatedActionSystem); string displayName = Guid.NewGuid().ToString(); quizGame.StartGame(new Mock <IChatClient>().Object); mockRepo.Setup(x => x.List(It.IsAny <DataItemPolicy <QuizQuestion> >())) .Returns(new List <QuizQuestion> { new QuizQuestion() }); automatedActionSystem.IntervalAction.Invoke(); // run the action, starting the questions var result = quizGame.AttemptToJoin(new ChatUser { DisplayName = displayName }); result.Should().Be(QuizJoinResults.NotJoinTimeResult(displayName)); }
private static (TestableVoteCommand, CommandReceivedEventArgs, VotingSystem, FakeActionSystem) GetTestOperation(ChatUser chatUser = null) { var mock = new Mock <IVotingDisplayNotification>(); var votingSystem = new VotingSystem(mock.Object); votingSystem.StartVote(new List <string> { "A", "B", "C" }); var automationSystem = new FakeActionSystem(); var endVoteOperation = new TestableVoteCommand(new Mock <IRepository>().Object, votingSystem, automationSystem); var commandReceivedEventArgs = new CommandReceivedEventArgs { Arguments = new List <string> { "end" }, ChatUser = chatUser ?? new ChatUser { Role = UserRole.Mod } }; return(endVoteOperation, commandReceivedEventArgs, votingSystem, automationSystem); }