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); }
public void Given_NotStartedVoting_When_Vote_Then_Exception() { var voting = new Voting(); Action action = () => voting.Vote("C#"); Assert.ThrowsAny <InvalidOperationException>(action); }
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_Vote_ForNotValid_Topic_Then_Exception() { var voting = new Voting(); voting.Start("DEV", "OPS"); Action action = () => voting.Vote("DEVOPS"); Assert.ThrowsAny <InvalidOperationException>(action); }
public void Vote_Test() { var voting = new Voting(); voting.Start("C#", "Java"); voting.Vote("C#"); Assert.Equal(new Dictionary <string, int> { { "C#", 1 }, { "Java", 0 }, }, voting.Votes); }
public void Given_StartedVoting_When_Vote_Then_VoteCreated() { var voting = new Voting(); voting.Start("DEV", "OPS"); voting.Vote("DEV"); Assert.Equal(voting.Votes, new Dictionary <string, int>() { { "DEV", 1 }, { "OPS", 0 } }); }
public async Task <object> Vote([FromBody] string topic) => await ExecuteCommand(() => _voting.Vote(topic));
public object Put([FromBody] string value) { _voting.Vote(value); return(_voting.GetState()); }