/// <summary>
            /// Create a new attachment with a name
            /// </summary>
            /// <param name="name">The name of the attachment</param>
            /// <param name="asset">The asset this attachment belongs to</param>
            /// <param name="filename">The name of the original attachment file</param>
            /// <param name="stream">The read-enabled stream that contains the attachment content to upload</param>
            /// <param name="attributes">Required attributes.</param>
            /// <returns>A newly minted Attachment that exists in the VersionOne system.</returns>
            public Attachment Attachment(string name, BaseAsset asset, string filename, Stream stream,
                IDictionary<string, object> attributes) {
                var attachment = new Attachment(instance) {
                    Asset = asset, 
                    Name = name, 
                    Filename = filename, 
                    ContentType = MimeType.Resolve(filename)
                };
                AddAttributes(attachment, attributes);
                attachment.Save();

                if(stream != null) {
                    attachment.ReadFrom(stream);
                }

                return attachment;
            }
 /// <summary>
 /// Create a new n0te with a name, asset, content, and 'personal' flag 
 /// </summary>
 /// <param name="name">The initial name of the n0te</param>
 /// <param name="asset">The asset this n0te belongs to</param>
 /// <param name="content">The content of the n0te</param>
 /// <param name="personal">True if this n0te is only visible to </param>
 /// <param name="attributes">Required attributes.</param>
 /// <returns>A newly minted n0te that exists in the VersionOne system.</returns>
 public Note Note(string name, BaseAsset asset, string content, bool personal,
     IDictionary<string, object> attributes) {
     var note = new Note(instance) {
         Asset = asset, 
         Name = name, 
         Content = content, 
         Personal = personal
     };
     AddAttributes(note, attributes);
     note.Save();
     return note;
 }
 /// <summary>
 /// Create a new attachment with a name
 /// </summary>
 /// <param name="name">The name of the attachment</param>
 /// <param name="asset">The asset this attachment belongs to</param>
 /// <param name="filename">The name of the original attachment file</param>
 /// <param name="stream">The read-enabled stream that contains the attachment content to upload</param>
 /// <returns>A newly minted Attachment that exists in the VersionOne system.</returns>
 public Attachment Attachment(string name, BaseAsset asset, string filename, Stream stream) {
     return Attachment(name, asset, filename, stream, null);
 }
 /// <summary>
 /// Create a new n0te with a name, asset, content, and 'personal' flag 
 /// </summary>
 /// <param name="name">The initial name of the n0te</param>
 /// <param name="asset">The asset this n0te belongs to</param>
 /// <param name="content">The content of the n0te</param>
 /// <param name="personal">True if this n0te is only visible to </param>
 /// <returns>A newly minted n0te that exists in the VersionOne system.</returns>
 public Note Note(string name, BaseAsset asset, string content, bool personal) {
     return Note(name, asset, content, personal, null);
 }
 /// <summary>
 /// Create a new link with a name
 /// </summary>
 /// <param name="name">The initial name of the link</param>
 /// <param name="asset">The asset this link belongs to</param>
 /// <param name="url">The URL of the link</param>
 /// <param name="onMenu">True to show on the asset's detail page menu</param>
 /// <param name="attributes">Required attributes.</param>
 /// <returns>A newly minted Link that exists in the VersionOne system.</returns>
 public Link Link(string name, BaseAsset asset, string url, bool onMenu,
     IDictionary<string, object> attributes) {
     var link = new Link(instance) {
         Asset = asset, 
         Name = name, 
         URL = url, 
         OnMenu = onMenu
     };
     AddAttributes(link, attributes);
     link.Save();
     return link;
 }
 /// <summary>
 /// Create a new link with a name
 /// </summary>
 /// <param name="name">The initial name of the link</param>
 /// <param name="asset">The asset this link belongs to</param>
 /// <param name="url">The URL of the link</param>
 /// <param name="onMenu">True to show on the asset's detail page menu</param>
 /// <returns>A newly minted Link that exists in the VersionOne system.</returns>
 public Link Link(string name, BaseAsset asset, string url, bool onMenu) {
     return Link(name, asset, url, onMenu, null);
 }
Пример #7
0
 private static string Reference(BaseAsset asset)
 {
     return string.Format("\"{0}\" ({1})", asset.Name, asset.ID);
 }
        public void TearDown() {
            var assetsToCleanup = new BaseAsset[]
                                  {task1, task2, task3, story1, story2, iteration, project, schedule, member};

            foreach(var asset in assetsToCleanup.Where(asset => asset != null && asset.CanDelete)) {
                asset.Delete();
            }
        }