Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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));
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
 public void TestBuildRoweKey()
 {
     Assert.AreEqual(string.Format("VOTE;{0};{1}", id, Nickname), VoteEntity.BuildRowKey(id, Nickname));
 }
Exemplo n.º 7
0
 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));
 }
Exemplo n.º 8
0
 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))));
 }