public void Given_NotStartedVoting_When_Finish_Then_Exception()
        {
            var voting = new Voting();

            Action action = () => voting.Finish();

            Assert.ThrowsAny <InvalidOperationException>(action);
        }
Example #2
0
        public void Finish_Testing()
        {
            var voting = new Voting();

            voting.Start("C#", "Java");
            voting.Vote("C#");
            var votingState = voting.Finish();

            Assert.Equal("C#", votingState.Winner);
        }
        public void Given_StartedVoting_When_Finish_With_Same_Votes_Then_Exception()
        {
            var voting = new Voting();

            voting.Start("DEV", "OPS");
            voting.Vote("DEV");
            voting.Vote("OPS");

            Action action = () => voting.Finish();

            Assert.ThrowsAny <InvalidOperationException>(action);
        }
        public void Given_StartedVoting_When_Finish_Then_Winner()
        {
            var voting = new Voting();

            voting.Start("DEV", "OPS");
            voting.Vote("DEV");
            voting.Vote("DEV");
            voting.Vote("OPS");

            voting.Finish();

            Assert.Equal("DEV", voting.Winner);
        }
Example #5
0
 public object Delete()
 {
     _voting.Finish();
     return(_voting.GetState());
 }