Esempio n. 1
0
        public void SubmitNoteNullText()
        {
            IssueNote note = new IssueNote();

            note.Text = null;
            Session.Request.IssueNoteAdd(issueId, note);
        }
Esempio n. 2
0
        public void SubmitNoteToInvalidIssueId()
        {
            IssueNote note = new IssueNote();

            note.Text = "   ";
            Session.Request.IssueNoteAdd(-5, note);
        }
Esempio n. 3
0
        public void SubmitNoteBlank()
        {
            IssueNote note = new IssueNote();

            note.Text = "   ";
            Session.Request.IssueNoteAdd(issueId, note);
        }
Esempio n. 4
0
        private IssueNote GetRandomNote()
        {
            IssueNote note = new IssueNote();

            note.Text = String.Format("NoteText {0}", Guid.NewGuid().ToString());
            return(note);
        }
        public void IssueUpdateToUpdateNotes()
        {
            Issue issue   = this.GetRandomIssue();
            int   issueId = Session.Request.IssueAdd(issue);

            IssueNote originalNote   = this.GetRandomNote();
            int       originalNoteId = Session.Request.IssueNoteAdd(issueId, originalNote);

            try
            {
                issue = Session.Request.IssueGet(issueId);

                Assert.AreEqual(1, issue.Notes.Length);
                Assert.AreEqual(originalNoteId, issue.Notes[0].Id);
                Assert.AreEqual(originalNote.Text, issue.Notes[0].Text);

                const string NewNoteText = "new note text";

                issue.Notes[0].Text = NewNoteText;

                Session.Request.IssueUpdate(issue);

                Issue issueWithUpdatedNote = Session.Request.IssueGet(issueId);

                Assert.AreEqual(1, issueWithUpdatedNote.Notes.Length);
                Assert.AreEqual(originalNoteId, issueWithUpdatedNote.Notes[0].Id);
                Assert.AreEqual(NewNoteText, issueWithUpdatedNote.Notes[0].Text);
            }
            finally
            {
                Session.Request.IssueDelete(issueId);
            }
        }
Esempio n. 6
0
        public void SubmitNoteEmpty()
        {
            IssueNote note = new IssueNote();

            note.Text = string.Empty;
            int issueNoteId = Session.Request.IssueNoteAdd(issueId, note);
        }
        public void IssueUpdateToAddNotes()
        {
            Issue issue   = this.GetRandomIssue();
            int   issueId = Session.Request.IssueAdd(issue);

            try
            {
                issue = Session.Request.IssueGet(issueId);

                Assert.AreEqual(0, issue.Notes.Length);

                IssueNote note = this.GetRandomNote();
                issue.Notes    = new IssueNote[1];
                issue.Notes[0] = note;

                Session.Request.IssueUpdate(issue);

                Issue issueWithNote = Session.Request.IssueGet(issueId);

                Assert.AreEqual(1, issueWithNote.Notes.Length);
                Assert.AreEqual(note.Text, issueWithNote.Notes[0].Text);
            }
            finally
            {
                Session.Request.IssueDelete(issueId);
            }
        }
        public void IssueUpdateWithNotesNoChanges()
        {
            Issue issue   = this.GetRandomIssue();
            int   issueId = Session.Request.IssueAdd(issue);

            try
            {
                IssueNote note = this.GetRandomNote();
                Session.Request.IssueNoteAdd(issueId, note);

                Issue issueWithNote = Session.Request.IssueGet(issueId);

                Assert.AreEqual(1, issueWithNote.Notes.Length);

                Session.Request.IssueUpdate(issueWithNote);

                Issue issueWithNoteAfterUpdate = Session.Request.IssueGet(issueId);

                Assert.AreEqual(1, issueWithNoteAfterUpdate.Notes.Length);
                Assert.AreEqual(note.Text, issueWithNoteAfterUpdate.Notes[0].Text);
            }
            finally
            {
                Session.Request.IssueDelete(issueId);
            }
        }
Esempio n. 9
0
        public IssueNoteEntity Update(EmployeeEntity EmployeeEntity, Guid IssueNoteId, IssueNoteEntity IssueNoteEntity)
        {
            IssueNoteEntity.Id = IssueNoteId;
            IssueNote IssueNote = new IssueNote(IssueNoteEntity);

            UnitOfWork.IssueNoteRepository.AddOrUpdate(IssueNote);
            UnitOfWork.Complete();
            return(Get(EmployeeEntity, IssueNote.Id));
        }
Esempio n. 10
0
        public IssueNoteEntity Create(EmployeeEntity EmployeeEntity, IssueNoteEntity IssueNoteEntity)
        {
            if (IssueNoteEntity == null)
            {
                throw new NotFoundException();
            }

            IssueNote IssueNote = new IssueNote(IssueNoteEntity);

            UnitOfWork.IssueNoteRepository.AddOrUpdate(IssueNote);
            UnitOfWork.Complete();
            return(Get(EmployeeEntity, IssueNote.Id));
        }
Esempio n. 11
0
        public void SubmitNoteAndCheckIt()
        {
            IssueNote note = GetRandomNote();

            int noteId = Session.Request.IssueNoteAdd(issueId, note);

            try
            {
                Assert.IsTrue(noteId > 0, "added note id must be greater than 0");

                Issue ownerIssue = Session.Request.IssueGet(issueId);

                Assert.IsTrue(ownerIssue.Notes.Length > 0, "There must be at least 1 note associated with the issue.");

                IssueNote retNote = null;

                foreach (IssueNote currentNote in ownerIssue.Notes)
                {
                    if (currentNote.Id == noteId)
                    {
                        retNote = currentNote;
                    }
                }

                Assert.IsNotNull(note);

                Assert.IsTrue(retNote.Id == noteId, "Note Id must be greater than 0");
                Assert.IsTrue(retNote.Author.Id > 0, "Author id must be greater than 0");
                Assert.AreEqual(retNote.Text, note.Text, "Verify note text");

                TimeSpan ts = DateTime.Now.Date - retNote.DateSubmitted.Date;
                Assert.IsTrue(ts.TotalMinutes <= 1, "Verify date submitted");

                ts = DateTime.Now.Date - retNote.LastModified.Date;
                Assert.IsTrue(ts.TotalMinutes <= 1, "Verify last modified");
            }
            finally
            {
                if (noteId > 0)
                {
                    Session.Request.IssueNoteDelete(noteId);
                }
            }
        }
Esempio n. 12
0
        public void can_save_new_issue()
        {
            Company company = new Company();
            company.Name = "Test Company";
            company.CreateAndFlush();

            Issue issue = new Issue();
            issue.Title = "Test issue";
            issue.Type = IssueType.Defect;

            IssueNote note = new IssueNote();
            note.Body = "Test note";
            issue.AddNote(note);

            IssueChange change = new IssueChange();
            change.PropertyName = "Test change";
            issue.AddChange(change);

            IssueAttachment att = new IssueAttachment();
            att.Body = new byte[10];
            att.Title = "Test attachment";
            issue.AddAttachment(att);

            Project project = new Project();
            project.Company = company;
            project.AddIssue(issue);
            project.Name = "Test project";
            project.CreateAndFlush();

            using (SessionScope newScope = new SessionScope())
            {
                Issue actual = Issue.Find(issue.Id);
                Assert.AreEqual("Test issue", actual.Title);
                Assert.AreEqual("Test note", actual.Notes[0].Body);
                Assert.AreEqual("Test change", actual.Changes[0].PropertyName);
                Assert.AreEqual("Test attachment", actual.Attachments[0].Title);
            }

            project.DeleteAndFlush();
            company.DeleteAndFlush();
        }
Esempio n. 13
0
        public void SubmitIssueWithNotesAndCheckIt()
        {
            int projectId = FirstProjectId;

            string note1Text = "This is the text for the first note";
            string note2Text = "This is the text for the second note";

            IssueNote note1 = new IssueNote();

            note1.Text = note1Text;

            IssueNote note2 = new IssueNote();

            note2.Text = note2Text;

            Issue issue = new Issue();

            issue.Project     = new ObjectRef(projectId);
            issue.Summary     = GetRandomSummary();
            issue.Description = GetRandomDescription();
            issue.Category    = new ObjectRef(GetFirstCategory(projectId));
            issue.Notes       = new IssueNote[] { note1, note2 };

            int issueId = Session.Request.IssueAdd(issue);

            try
            {
                Issue issueRet = Session.Request.IssueGet(issueId);

                Assert.IsNotNull(issueRet);
                Assert.IsNotNull(issueRet.Notes);
                Assert.AreEqual(2, issueRet.Notes.Length);
                Assert.AreEqual(note1Text, issueRet.Notes[0].Text);
                Assert.AreEqual(note2Text, issueRet.Notes[1].Text);
            }
            finally
            {
                Session.Request.IssueDelete(issueId);
            }
        }
Esempio n. 14
0
 public IssueNoteEntity(IssueNote IssueNote, params object[] args) : base(IssueNote)
 {
     foreach (object arg in args)
     {
         if (arg is Customer Customer)
         {
             CustomerEntity = new CustomerEntity(Customer);
         }
         if (arg is Invoice Invoice)
         {
             InvoiceEntity = new InvoiceEntity(Invoice);
         }
         if (arg is WareHouse WareHouse)
         {
             WareHouseEntity = new WareHouseEntity(WareHouse);
         }
         if (arg is ICollection <IssueNoteLine> IssueNoteLines)
         {
             IssueNoteLineEntities = IssueNoteLines.Select(model => new IssueNoteLineEntity(model, model.Product)).ToList();
         }
     }
 }
        public void ProcessImage(int issueId, string fullSizePath, string fileName, string note)
        {
            // get file name from the user as input to save on the server.
            try
            {
                Session session = new Session(this.PluginSettings.Url, this.PluginSettings.UserName, this.PluginSettings.Password, null);
                session.Request.IssueAttachmentAdd(issueId, fullSizePath, fileName);

                if (note.Trim().Length > 0)
                {
                    IssueNote issueNote = new IssueNote();
                    issueNote.Text = note;
                    session.Request.IssueNoteAdd(issueId, issueNote);
                }

                string message = "Snapshot successfully uploaded";
                MessageBox.Show(message, "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (SoapException ex)
            {
                MessageBox.Show(ex.Message, "Failure", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 16
0
        public IssueNoteEntity Get(EmployeeEntity EmployeeEntity, Guid IssueNoteId)
        {
            IssueNote IssueNote = UnitOfWork.IssueNoteRepository.Get(IssueNoteId);

            return(new IssueNoteEntity(IssueNote));
        }
Esempio n. 17
0
 private IssueNote GetRandomNote()
 {
     IssueNote note = new IssueNote();
     note.Text = String.Format("NoteText {0}", Guid.NewGuid().ToString());
     return note;
 }
Esempio n. 18
0
		public void SubmitNoteEmpty()
		{
			IssueNote note = new IssueNote();
			note.Text = string.Empty;
			int issueNoteId = Session.Request.IssueNoteAdd( issueId, note );
		}
Esempio n. 19
0
		public void SubmitNoteNullText()
		{
			IssueNote note = new IssueNote();
			note.Text = null;
			Session.Request.IssueNoteAdd( issueId, note );
		}
Esempio n. 20
0
		public void SubmitNoteToInvalidIssueId()
		{
			IssueNote note = new IssueNote();
			note.Text = "   ";
			Session.Request.IssueNoteAdd( -5, note );
		}
Esempio n. 21
0
        public void SubmitIssueWithNotesAndCheckIt()
        {
            int projectId = FirstProjectId;

            string note1Text = "This is the text for the first note";
            string note2Text = "This is the text for the second note";

            IssueNote note1 = new IssueNote();
            note1.Text = note1Text;

            IssueNote note2 = new IssueNote();
            note2.Text = note2Text;

            Issue issue = new Issue();
            issue.Project = new ObjectRef( projectId );
            issue.Summary = GetRandomSummary();
            issue.Description = GetRandomDescription();
            issue.Category = new ObjectRef( GetFirstCategory( projectId ) );
            issue.Notes = new IssueNote[] { note1, note2 };

            int issueId = Session.Request.IssueAdd( issue );

            try
            {
                Issue issueRet = Session.Request.IssueGet( issueId );

                Assert.IsNotNull( issueRet );
                Assert.IsNotNull( issueRet.Notes );
                Assert.AreEqual( 2, issueRet.Notes.Length );
                Assert.AreEqual( note1Text, issueRet.Notes[0].Text );
                Assert.AreEqual( note2Text, issueRet.Notes[1].Text );
            }
            finally
            {
                Session.Request.IssueDelete( issueId );
            }
        }
Esempio n. 22
0
		public void SubmitNoteBlank()
		{
			IssueNote note = new IssueNote();
			note.Text = "   ";
			Session.Request.IssueNoteAdd( issueId, note );
		}