public void Attachment_Fetch_Info_List()
        {
            var project = ProjectTestHelper.ProjectAdd();

            AttachmentTestHelper.AttachmentAdd(project.ProjectId, SourceType.Project);
            AttachmentTestHelper.AttachmentAdd(project.ProjectId, SourceType.Project);

            var attachments = AttachmentRepository.AttachmentFetchInfoList(new AttachmentDataCriteria());

            Assert.IsTrue(attachments.Count() > 1, "Row returned should be greater than one");
        }
        public void Attachment_Fetch()
        {
            var project = ProjectTestHelper.ProjectAdd();

            var attachment = AttachmentTestHelper.AttachmentNew(project.ProjectId, SourceType.Project);

            attachment = AttachmentRepository.AttachmentSave(attachment);

            attachment = AttachmentRepository.AttachmentFetch(attachment.AttachmentId);

            Assert.IsTrue(attachment != null, "Row returned should not equal null");
        }
        public void Attachment_Add()
        {
            var project = ProjectTestHelper.ProjectAdd();

            var attachment = AttachmentTestHelper.AttachmentNew(project.ProjectId, SourceType.Project);

            Assert.IsTrue(attachment.IsValid, "IsValid should be true");

            attachment = AttachmentRepository.AttachmentSave(attachment);

            Assert.IsTrue(attachment.AttachmentId != 0, "AttachmentId should be a non-zero value");

            AttachmentRepository.AttachmentFetch(attachment.AttachmentId);
        }
        public void Attachment_Edit()
        {
            var project = ProjectTestHelper.ProjectAdd();

            var attachment = AttachmentTestHelper.AttachmentNew(project.ProjectId, SourceType.Project);

            var name = attachment.Name;

            Assert.IsTrue(attachment.IsValid, "IsValid should be true");

            attachment = AttachmentRepository.AttachmentSave(attachment);

            attachment = AttachmentRepository.AttachmentFetch(attachment.AttachmentId);

            attachment.Name = DataHelper.RandomString(20);

            attachment = AttachmentRepository.AttachmentSave(attachment);

            attachment = AttachmentRepository.AttachmentFetch(attachment.AttachmentId);

            Assert.IsTrue(attachment.Name != name, "Name should have different value");
        }
        public void Attachment_Delete()
        {
            var project = ProjectTestHelper.ProjectAdd();

            var attachment = AttachmentTestHelper.AttachmentNew(project.ProjectId, SourceType.Project);

            Assert.IsTrue(attachment.IsValid, "IsValid should be true");

            attachment = AttachmentRepository.AttachmentSave(attachment);

            attachment = AttachmentRepository.AttachmentFetch(attachment.AttachmentId);

            AttachmentRepository.AttachmentDelete(attachment.AttachmentId);

            try
            {
                AttachmentRepository.AttachmentFetch(attachment.AttachmentId);
            }
            catch (Exception ex)
            {
                Assert.IsTrue(ex.GetBaseException() is InvalidOperationException);
            }
        }