private List <LocalStoredAttachment> CreateAttachments(IEnumerable <attachment> attachments)
        {
            var storedAttachments = new List <LocalStoredAttachment>();

            foreach (var attachment in attachments.Where(a => a.isobsolete == isobsolete._0 && a.data.Value != null))
            {
                var    attachmentFileName = GetAttachmentFileName(attachment);
                FileId fileId             = null;

                try
                {
                    fileId = SaveAttachmentFile(attachment);

                    var localAttachment = new LocalStoredAttachment
                    {
                        FileId      = fileId,
                        FileName    = attachmentFileName,
                        Description = attachment.desc,
                        OwnerId     = ObjectFactory.GetInstance <IUserMapper>().GetTpIdBy(attachment.attacher),
                        CreateDate  = CreateDateConverter.ParseFromBugzillaLocalTime(attachment.date)
                    };

                    storedAttachments.Add(localAttachment);
                }
                catch (Exception ex)
                {
                    ObjectFactory.GetInstance <IActivityLogger>().Error(
                        string.Format("Cannot import attachment. Bugzilla Bug ID: {1}; File name: {0}", attachmentFileName, bug_id), ex);

                    if (fileId != null && File.Exists(AttachmentFolder.GetAttachmentFileFullPath(fileId)))
                    {
                        AttachmentFolder.Delete(new[] { fileId });
                    }
                }
            }

            return(storedAttachments);
        }
 public void FileStorageShouldReturnFile(string accountName, string profileName, string fileName)
 {
     File.Exists(AttachmentFolder.GetAttachmentFileFullPath(new FileId(Guid.Parse(fileName)))).Should(Be.True);
 }