public void ToJson_ShouldDeserializeDataObject() { // arrange var data = new Dictionary <string, object> { { "Name", "Keith" } }; var target = new EmailMessageParams { Data = data }; // act var serialized = EmailMessageParams.ToJson(target); var deserialized = EmailMessageParams.FromJson(serialized); // assert Assert.Equal(data, deserialized.Data); }
public async Task <EmailMessageParams> GetAsync(EmailQueueToken token, CancellationToken cancellationToken) { _logger.LogTrace("Getting blob from store for token {0}", token); if (!_initialized) { await InitializeAsync(cancellationToken); } var blobName = GetBlobName(token); var blob = _container.Value.GetBlockBlobReference(blobName); if (await blob.ExistsAsync()) { var json = await blob.DownloadTextAsync(Encoding.UTF8, null, null, null, cancellationToken); return(EmailMessageParams.FromJson(json)); } return(null); }