Ejemplo n.º 1
0
        public void AddGetDeleteSingleEntityTest()
        {
            // Arrange
            ITableManager tableManager  = new TableManager(new ConfigManagerHelper());
            const string  testTableName = "Test";
            var           entity        = new DiscoveredKeywordEntity
            {
                PartitionKey     = Guid.NewGuid().ToString(),
                RowKey           = Guid.NewGuid().ToString(),
                OccurrenceInFeed = 2,
                Text             = Guid.NewGuid().ToString(),
                Volume           = 10
            };

            // Act
            tableManager.InsertOrMerge(testTableName, entity);
            var entityRetrieved = tableManager.Get <DiscoveredKeywordEntity>(testTableName, entity.PartitionKey, entity.RowKey);

            // Cleanup
            tableManager.Delete(testTableName, entity);
            var entityRetrievedAfterDelete = tableManager.Get <DiscoveredKeywordEntity>(testTableName, entity.PartitionKey, entity.RowKey);

            // Assert
            Assert.IsNotNull(entityRetrieved);
            Assert.IsNull(entityRetrievedAfterDelete);
            Assert.AreEqual(entity.PartitionKey, entityRetrieved.PartitionKey);
            Assert.AreEqual(entity.RowKey, entityRetrieved.RowKey);
            Assert.AreEqual(entity.OccurrenceInFeed, entityRetrieved.OccurrenceInFeed);
            Assert.AreEqual(entity.Volume, entityRetrieved.Volume);
            Assert.AreEqual(entity.Text, entityRetrieved.Text);
        }
 public void AddGetDeleteSingleEntityTest()
 {
     // Arrange
     ITableManager tableManager = new TableManager(new ConfigManagerHelper());
     const string testTableName = "Test";
     var entity = new DiscoveredKeywordEntity
     {
         PartitionKey = Guid.NewGuid().ToString(),
         RowKey = Guid.NewGuid().ToString(),
         OccurrenceInFeed = 2,
         Text = Guid.NewGuid().ToString(),
         Volume = 10
     };
     // Act
     tableManager.InsertOrMerge(testTableName, entity);
     var entityRetrieved = tableManager.Get<DiscoveredKeywordEntity>(testTableName, entity.PartitionKey, entity.RowKey);
     // Cleanup
     tableManager.Delete(testTableName, entity);
     var entityRetrievedAfterDelete = tableManager.Get<DiscoveredKeywordEntity>(testTableName, entity.PartitionKey, entity.RowKey);
     // Assert
     Assert.IsNotNull(entityRetrieved);
     Assert.IsNull(entityRetrievedAfterDelete);
     Assert.AreEqual(entity.PartitionKey, entityRetrieved.PartitionKey);
     Assert.AreEqual(entity.RowKey, entityRetrieved.RowKey);
     Assert.AreEqual(entity.OccurrenceInFeed, entityRetrieved.OccurrenceInFeed);
     Assert.AreEqual(entity.Volume, entityRetrieved.Volume);
     Assert.AreEqual(entity.Text, entityRetrieved.Text);
 }