示例#1
0
        public void Given_NotStartedVoting_When_Finish_Then_Exception()
        {
            var voting = new Voting();

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

            Assert.ThrowsAny <InvalidOperationException>(action);
        }
示例#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);
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }
示例#5
0
 public object Delete()
 {
     _voting.Finish();
     return(_voting.GetState());
 }