/// <summary> /// Save Content /// </summary> /// <typeparam name="T">Text Content Type</typeparam> /// <param name="content">Content</param> private void Save <T>(string content) where T : TextContent { var container = new XmlContainer <T>(ServerConfiguration.Default); var blogPost = Activator.CreateInstance <T>(); blogPost.Content = content; blogPost.CreatedOn = DateTime.UtcNow; blogPost.Active = true; blogPost.Deleted = false; blogPost.Id = Guid.NewGuid(); container.Save(blogPost.Id.ToString(), blogPost); }
public void SaveGet() { Random random = new Random(); TextContainer <EntityWithDataStore> container = new XmlContainer <EntityWithDataStore>(CloudStorageAccount.DevelopmentStorageAccount); container.EnsureExist(); var entity = new EntityWithDataStore() { PartitionKey = Guid.NewGuid().ToBase64(), RowKey = Guid.NewGuid().ToAscii85(), ToTest = random.Next() }; var id = Guid.NewGuid().ToString(); container.Save(id, entity); var returned = container.Get(id); Assert.IsNotNull(returned); Assert.AreEqual <string>(entity.PartitionKey, returned.PartitionKey); Assert.AreEqual <string>(entity.RowKey, returned.RowKey); Assert.AreEqual <int>(entity.ToTest, returned.ToTest); }