public void GetFilepath_DescriptorNull() { // arrange AttachmentDescriptor descriptor = null; // act Action validate = () => descriptor.GetFilepath(); // assert Assert.Throws <ArgumentNullException>("descriptor", validate); }
public void GetFilepath_Success() { // arrange AttachmentDescriptor descriptor = new AttachmentDescriptor { Id = "UNIQUE", Name = "561" }; // act string filepath = descriptor.GetFilepath(); // assert Assert.Equal("UNIQUE\\561", filepath); }
/// <inheritdoc/> public async Task UploadAsync(AttachmentDescriptor descriptor, CancellationToken cancellationToken) { if (descriptor == null) { throw new ArgumentNullException(nameof(descriptor)); } try { await _container.GetBlockBlobReference(descriptor.GetFilepath()) .UploadFromByteArrayAsync(descriptor.Value, 0, descriptor.Value.Length, cancellationToken) .ConfigureAwait(false); } catch (Exception) { // todo: log via event provider } }