RavenGallery.Core.Infrastructure.RavenFileStorageService.StoreFile C# (CSharp) Method

StoreFile() public method

public StoreFile ( string filename, byte bytes ) : void
filename string
bytes byte
return void
        public void StoreFile(string filename, byte[] bytes)
        {
            documentStore.DatabaseCommands.PutAttachment(filename, null, bytes, new Newtonsoft.Json.Linq.JObject());
        }

Usage Example

コード例 #1
0
        public void WhenStoreFileInvokedWithValidArguments_AttachmentIsCreatedInRaven()
        {
            Byte[] fileBytes = new Byte[] { 3,1,4,1,5,9};
            String filename = "images/mySuperDuperFile";
            RavenFileStorageService storage = new RavenFileStorageService(this.Store);

            storage.StoreFile(filename, fileBytes);

            var retrievedAttachment = this.Store.DatabaseCommands.GetAttachment(filename);
            Assert.AreEqual(fileBytes, retrievedAttachment.Data);
        }