/// <summary> /// Add this encrypted voter data to the database! /// </summary> /// <param name="data">The data to add.</param> private void Add(EncryptedVoterData data) { Contract.Requires(!Equals(data, null)); Contract.Requires(Contract.ForAll(AllData, row => !row.CPR.Value.IsIdenticalTo(data.CPR.Value) && !row.VoterNumber.Value.IsIdenticalTo(data.VoterNumber.Value))); _db.Voters.AddObject(Voter.CreateVoter(data.VoterNumber, data.CPR, data.BallotStatus)); _db.SaveChanges(); }
public void EncryptedVoterDataTest() { var voternumber = new CipherText(new byte[] { 2, 1 }); var cpr = new CipherText(new byte[] { 3, 2 }); var ballotstatus = new CipherText(new byte[] { 4, 3 }); var encVoterData = new EncryptedVoterData(voternumber, cpr, ballotstatus); Assert.That(voternumber.Equals(encVoterData.VoterNumber)); Assert.That(cpr.Equals(encVoterData.CPR)); Assert.That(ballotstatus.Equals(encVoterData.BallotStatus)); Assert.That(encVoterData.ToString() != null); }