public void TestToVoteBll() { var voteEntity = new VoteEntity { PartitionKey = VoteEntity.BuildPartitionkey(City, date), RowKey = VoteEntity.BuildRowKey(id, Nickname), Value = 5 }; VoteBll voteBll = VoteEntity.ToVoteBll(voteEntity); Assert.AreEqual(5, voteBll.Value); }
public void TestExtractFromPartitionKey() { var voteEntity = new VoteEntity { PartitionKey = VoteEntity.BuildPartitionkey(City, date), RowKey = VoteEntity.BuildRowKey(id, Nickname) }; Tuple <string, DateTime> tuple = VoteEntity.ExtractFromPartitionKey(voteEntity.PartitionKey); Assert.AreEqual(City, tuple.Item1); Assert.AreEqual(date, tuple.Item2); }
public void ExtractFromRowKey() { var voteEntity = new VoteEntity { PartitionKey = VoteEntity.BuildPartitionkey(City, date), RowKey = VoteEntity.BuildRowKey(id, Nickname), Value = 5 }; Tuple <Guid, string> tuple = VoteEntity.ExtractFromRowKey(voteEntity.RowKey); Assert.AreEqual(id, tuple.Item1); Assert.AreEqual(Nickname, tuple.Item2); }
public void TestEquals() { var voteEntity1 = new VoteEntity { PartitionKey = VoteEntity.BuildPartitionkey(City, date), RowKey = VoteEntity.BuildRowKey(id, Nickname) }; var voteEntity2 = new VoteEntity { PartitionKey = VoteEntity.BuildPartitionkey(City, date), RowKey = VoteEntity.BuildRowKey(id, Nickname) }; Assert.IsTrue(voteEntity1.Equals(voteEntity2)); }
public void TestMerge() { var oldVoteEntity = new VoteEntity { PartitionKey = VoteEntity.BuildPartitionkey(City, date), RowKey = VoteEntity.BuildRowKey(id, Nickname), Value = 4 }; var newVoteEntity = new VoteEntity { PartitionKey = VoteEntity.BuildPartitionkey(City, date), RowKey = VoteEntity.BuildRowKey(id, Nickname), Value = 5 }; oldVoteEntity.Merge(newVoteEntity); Assert.AreEqual(newVoteEntity, oldVoteEntity); }
public void TestBuildRoweKey() { Assert.AreEqual(string.Format("VOTE;{0};{1}", id, Nickname), VoteEntity.BuildRowKey(id, Nickname)); }
public async Task DeleteVote(string city, DateTime date, Guid id, string nickname) { await this.tableTableStore.DeleteTableEntity <VoteEntity>(VoteEntity.BuildPartitionkey(city, date), VoteEntity.BuildRowKey(id, nickname)); }
public async Task <VoteBll> GetVote(string city, DateTime date, Guid id, string nickname) { return(VoteEntity.ToVoteBll(await this.tableTableStore.GetTableEntity <VoteEntity>(VoteEntity.BuildPartitionkey(city, date), VoteEntity.BuildRowKey(id, nickname)))); }