public ArtifactDescriptor Save(PluginDescriptor owner, string contentType, object data)
        {
            var folder = Path.Combine(_baseFolder, owner.Name);

            var descriptor = new ArtifactDescriptor
            {
                Location = folder,
                Owner = owner
            };

            Directory.CreateDirectory(folder);

            var formatter = _formatters.Find(contentType);
            var filepath = Path.Combine(folder, Path.ChangeExtension(descriptor.Id.ToString(), DefaultExtension));

            using (var sw = new FileStream(filepath, FileMode.Create, FileAccess.Write, FileShare.None))
            {
                using (var datastream = formatter.Serialize(data))
                {
                    datastream.ChunkedOperation(4000, (buffer, size) =>
                                                          {
                                                              sw.Write(buffer, 0, size);
                                                          });
                }
            }

            return descriptor;
        }
 public void AssociateArtifact(ArtifactDescriptor artifact)
 {
     if (artifact != null)
     {
         Id = artifact.Id;
     }
 }
 public NotificationRequestBuilder AssociateArtifact(ArtifactDescriptor artifactDescriptor)
 {
     _request.AssociateArtifact(artifactDescriptor);
     return this;
 }
 public void TheArtifactIsSaved()
 {
     _artifactDescriptor = _sut.Save(_pluginDescriptor, ArtifactContentTypes.CSV, _data);
 }
 public NotificationRequest AssociateArtifact(ArtifactDescriptor artifactDescriptor)
 {
     Artifact = artifactDescriptor;
     return this;
 }
 public void AssociateArtifact(ArtifactDescriptor artifact)
 {
     if (artifact != null)
         Id = artifact.Id;
 }
 public NotificationRequest AssociateArtifact(ArtifactDescriptor artifactDescriptor)
 {
     Artifact = artifactDescriptor;
     return(this);
 }