public void InitializeVote() { var genesisBallot = new Ballot(); var voterKey = makeRandomSigningKey(); var ballot = new Ballot(); ballot.Id = Guid.NewGuid(); ballot.SubmissionDate = DateTime.UtcNow; ballot.BallotData = "{genesis for vote [put ID here]}"; ballot.SignBallot(voterKey); ballot.SignSecret(voterKey, "this is a secret"); ballot.LockBallotToChain(voterKey, Ballot.EmptyHash); ballots.Add(ballot); }
public void TestMethod1() { for (var i = 0; i < 1000; i++) { var voterKey = makeRandomSigningKey(); var vote = "{President:'Dogbert'}"; var ballot = new Ballot(); ballot.Id = Guid.NewGuid(); ballot.SubmissionDate = DateTime.UtcNow; ballot.BallotData = vote; ballot.SignBallot(voterKey); ballot.SignSecret(voterKey, "this is a secret"); ballot.LockBallotToChain(voterKey, ballots.Last().BallotHash); ballots.Add(ballot); voterKey.Dispose(); } var validation = Ballot.BallotChainIsValid(ballots); Assert.IsTrue(validation.ChainValid); }