예제 #1
0
        public async Task Given_StartedVoting_When_Vote_Then_SameState()
        {
            // Arrange
            var voting     = new Voting();
            var controller = new VotingController(voting, null);

            await controller.Start(new string[] { "C#", "F#" });

            // Act
            var result = await controller.Vote("C#");

            // Assert
            Assert.Equal(
                JsonConvert.SerializeObject(voting.GetState()),
                JsonConvert.SerializeObject(result));
        }
예제 #2
0
        public async Task Given_StartedVoting_WithVotes_When_Finish_Then_SameState()
        {
            // Arrange and Act
            var votingService = new InMemoryVotingService();
            var voting        = await votingService.Get();

            var controller = new VotingController(votingService, null, null);

            await controller.Start(new string[] { "C#", "F#" });

            await controller.Vote("C#");

            var result = await controller.Finish();

            // Assert
            Assert.Equal(
                JsonConvert.SerializeObject(voting.GetState()),
                JsonConvert.SerializeObject(result));
        }