Example #1
0
        public void Hour_Delete()
        {
            var hour = HourService.HourNew();

            var task = BusinessHelper.CreateTask();

            hour.ProjectId = task.ProjectId;
            hour.TaskId    = task.TaskId;
            hour.Date      = DateTime.Now.Date;
            hour.Duration  = 8;
            hour.Notes     = DataHelper.RandomString(100);

            hour = HourService.HourSave(hour);

            hour = HourService.HourFetch(hour.HourId);

            HourService.HourDelete(hour.HourId);

            try
            {
                HourService.HourFetch(hour.HourId);
            }
            catch (Exception ex)
            {
                Assert.IsTrue(ex.GetBaseException() is InvalidOperationException);
            }
        }
Example #2
0
        public void Hour_Fetch_List()
        {
            var hour = HourService.HourNew();

            var task = BusinessHelper.CreateTask();

            hour.ProjectId = task.ProjectId;
            hour.TaskId    = task.TaskId;
            hour.Date      = DateTime.Now.Date;
            hour.Duration  = 8;
            hour.Notes     = DataHelper.RandomString(100);

            HourService.HourSave(hour);

            hour = HourService.HourNew();

            hour.ProjectId = task.ProjectId;
            hour.TaskId    = task.TaskId;
            hour.Date      = DateTime.Now.Date;
            hour.Duration  = 8;
            hour.Notes     = DataHelper.RandomString(100);

            HourService.HourSave(hour);

            var hours = HourService.HourFetchInfoList();

            Assert.IsTrue(hours.Count > 1, "Hours should be greater than one");
        }
Example #3
0
        public void Invoice_Delete()
        {
            var invoice = InvoiceService.InvoiceNew();

            var task = BusinessHelper.CreateTask();

            invoice.Number      = DataHelper.RandomString(20);
            invoice.TaskId      = task.TaskId;
            invoice.Description = task.Description;

            invoice = InvoiceService.InvoiceSave(invoice);

            invoice = InvoiceService.InvoiceFetch(invoice.InvoiceId);

            InvoiceService.InvoiceDelete(invoice.InvoiceId);

            try
            {
                InvoiceService.InvoiceFetch(invoice.InvoiceId);
            }
            catch (Exception ex)
            {
                Assert.IsTrue(ex.GetBaseException() is InvalidOperationException);
            }
        }
Example #4
0
        public void Hour_Edit()
        {
            var hour  = HourService.HourNew();
            var notes = DataHelper.RandomString(100);

            var task = BusinessHelper.CreateTask();

            hour.ProjectId = task.ProjectId;
            hour.TaskId    = task.TaskId;
            hour.Date      = DateTime.Now.Date;
            hour.Duration  = 8;
            hour.Notes     = notes;

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

            hour = HourService.HourSave(hour);

            hour = HourService.HourFetch(hour.HourId);

            hour.Notes = DataHelper.RandomString(100);

            hour = HourService.HourSave(hour);

            hour = HourService.HourFetch(hour.HourId);

            Assert.IsTrue(hour.Notes != notes, "Notes should have different value");
        }
Example #5
0
        public void Label_Fetch()
        {
            var task  = BusinessHelper.CreateTask();
            var name  = DataHelper.RandomString(30);
            var label = LabelService.LabelAdd(SourceType.Task, task.TaskId, name);

            label = LabelService.LabelFetch(SourceType.Task, task.TaskId, name);

            Assert.IsFalse(label == null, "Label should not be null");
        }
Example #6
0
        public void Label_Fetch_List()
        {
            var task = BusinessHelper.CreateTask();

            LabelService.LabelAdd(SourceType.Task, task.TaskId, DataHelper.RandomString(30));
            LabelService.LabelAdd(SourceType.Task, task.TaskId, DataHelper.RandomString(30));

            var labels = LabelService.LabelFetchInfoList(SourceType.Task, task.TaskId);

            Assert.IsTrue(labels.Count > 1, "Labels should be greater than one");
        }
Example #7
0
        public void Label_Add()
        {
            var task  = BusinessHelper.CreateTask();
            var name  = DataHelper.RandomString(30);
            var label = LabelService.LabelAdd(SourceType.Task, task.TaskId, name);

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

            label = LabelService.LabelFetch(SourceType.Task, task.TaskId, name);

            Assert.IsTrue(label != null, "Object should not be null");
        }
Example #8
0
        public void Note_Fetch()
        {
            var task = BusinessHelper.CreateTask();
            var note = NoteService.NoteNew(SourceType.Task, task.TaskId);

            note.Body = DataHelper.RandomString(1000);

            note = NoteService.NoteSave(note);

            note = NoteService.NoteFetch(note.NoteId);

            Assert.IsFalse(note == null, "Note should not be null");
        }
Example #9
0
        public void Attachment_Fetch()
        {
            var task       = BusinessHelper.CreateTask();
            var attachment = AttachmentService.AttachmentNew(SourceType.Task, task.TaskId);

            attachment.Name     = DataHelper.RandomString(100);
            attachment.FileType = DataHelper.RandomString(30);

            attachment = AttachmentService.AttachmentSave(attachment);

            attachment = AttachmentService.AttachmentFetch(attachment.AttachmentId);

            Assert.IsFalse(attachment == null, "Attachment should not be null");
        }
Example #10
0
        public void Invoice_Add()
        {
            var invoice = InvoiceService.InvoiceNew();

            var task = BusinessHelper.CreateTask();

            invoice.Number      = DataHelper.RandomString(20);
            invoice.TaskId      = task.TaskId;
            invoice.Description = task.Description;

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

            InvoiceService.InvoiceSave(invoice);
        }
Example #11
0
        public void Note_Add()
        {
            var task = BusinessHelper.CreateTask();
            var note = NoteService.NoteNew(SourceType.Task, task.TaskId);

            note.Body = DataHelper.RandomString(1000);

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

            note = NoteService.NoteSave(note);

            note = NoteService.NoteFetch(note.NoteId);

            Assert.IsTrue(note != null, "Object should not be null");
        }
Example #12
0
        public void Attachment_Add()
        {
            var task       = BusinessHelper.CreateTask();
            var attachment = AttachmentService.AttachmentNew(SourceType.Task, task.TaskId);

            attachment.Name     = DataHelper.RandomString(100);
            attachment.FileType = DataHelper.RandomString(30);

            Assert.IsTrue(attachment.IsValid, string.Format("IsValid should be true, but has following errors: {0}", attachment.BrokenRulesCollection));

            attachment = AttachmentService.AttachmentSave(attachment);

            attachment = AttachmentService.AttachmentFetch(attachment.AttachmentId);

            Assert.IsTrue(attachment != null, "Object should not be null");
        }
Example #13
0
        public void Hour_Add()
        {
            var hour = HourService.HourNew();

            var task = BusinessHelper.CreateTask();

            hour.ProjectId = task.ProjectId;
            hour.TaskId    = task.TaskId;
            hour.Date      = DateTime.Now.Date;
            hour.Duration  = 8;
            hour.Notes     = DataHelper.RandomString(100);

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

            hour = HourService.HourSave(hour);
        }
Example #14
0
        public void Invoice_Fetch()
        {
            var invoice = InvoiceService.InvoiceNew();

            var task = BusinessHelper.CreateTask();

            invoice.Number      = DataHelper.RandomString(20);
            invoice.TaskId      = task.TaskId;
            invoice.Description = task.Description;

            invoice = InvoiceService.InvoiceSave(invoice);

            invoice = InvoiceService.InvoiceFetch(invoice.InvoiceId);

            Assert.IsFalse(invoice == null, "Invoice should not be null");
        }
Example #15
0
        public void Hour_Fetch()
        {
            var hour = HourService.HourNew();

            var task = BusinessHelper.CreateTask();

            hour.ProjectId = task.ProjectId;
            hour.TaskId    = task.TaskId;
            hour.Date      = DateTime.Now.Date;
            hour.Duration  = 8;
            hour.Notes     = DataHelper.RandomString(100);

            hour = HourService.HourSave(hour);

            hour = HourService.HourFetch(hour.HourId);

            Assert.IsFalse(hour == null, "Hour should not be null");
        }
Example #16
0
        public void Note_Fetch_List()
        {
            var task = BusinessHelper.CreateTask();
            var note = NoteService.NoteNew(SourceType.Task, task.TaskId);

            note.Body = DataHelper.RandomString(1000);

            NoteService.NoteSave(note);

            note = NoteService.NoteNew(SourceType.Task, task.TaskId);

            note.Body = DataHelper.RandomString(1000);

            NoteService.NoteSave(note);

            var notes = NoteService.NoteFetchInfoList(SourceType.Task, task.TaskId);

            Assert.IsTrue(notes.Count > 1, "Notes should be greater than one");
        }
Example #17
0
        public void Label_Delete()
        {
            var task = BusinessHelper.CreateTask();
            var name = DataHelper.RandomString(30);

            LabelService.LabelAdd(SourceType.Task, task.TaskId, name);

            LabelService.LabelFetch(SourceType.Task, task.TaskId, name);

            LabelService.LabelDelete(SourceType.Task, task.TaskId, name);

            try
            {
                LabelService.LabelFetch(SourceType.Task, task.TaskId, name);
            }
            catch (Exception ex)
            {
                Assert.IsTrue(ex.GetBaseException() is InvalidOperationException);
            }
        }
Example #18
0
        public void Attachment_Fetch_List()
        {
            var task       = BusinessHelper.CreateTask();
            var attachment = AttachmentService.AttachmentNew(SourceType.Task, task.TaskId);

            attachment.Name     = DataHelper.RandomString(100);
            attachment.FileType = DataHelper.RandomString(30);

            AttachmentService.AttachmentSave(attachment);

            attachment = AttachmentService.AttachmentNew(SourceType.Task, task.TaskId);

            attachment.Name     = DataHelper.RandomString(100);
            attachment.FileType = DataHelper.RandomString(30);

            AttachmentService.AttachmentSave(attachment);

            var attachments = AttachmentService.AttachmentFetchInfoList(SourceType.Task, task.TaskId);

            Assert.IsTrue(attachments.Count > 1, "Attachments should be greater than one");
        }
Example #19
0
        public void Note_Edit()
        {
            var task = BusinessHelper.CreateTask();
            var note = NoteService.NoteNew(SourceType.Task, task.TaskId);
            var body = DataHelper.RandomString(1000);

            note.Body = body;

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

            note = NoteService.NoteSave(note);

            note = NoteService.NoteFetch(note.NoteId);

            note.Body = DataHelper.RandomString(1000);

            note = NoteService.NoteSave(note);

            note = NoteService.NoteFetch(note.NoteId);

            Assert.IsTrue(note.Body != body, "Body should have different value");
        }
Example #20
0
        public void Note_Delete()
        {
            var task = BusinessHelper.CreateTask();
            var note = NoteService.NoteNew(SourceType.Task, task.TaskId);

            note.Body = DataHelper.RandomString(1000);

            note = NoteService.NoteSave(note);

            note = NoteService.NoteFetch(note.NoteId);

            NoteService.NoteDelete(note.NoteId);

            try
            {
                NoteService.NoteFetch(note.NoteId);
            }
            catch (Exception ex)
            {
                Assert.IsTrue(ex.GetBaseException() is InvalidOperationException);
            }
        }
Example #21
0
        public void Invoice_Edit()
        {
            var invoice = InvoiceService.InvoiceNew();

            var task = BusinessHelper.CreateTask();

            invoice.Number      = DataHelper.RandomString(20);
            invoice.TaskId      = task.TaskId;
            invoice.Description = task.Description;

            invoice = InvoiceService.InvoiceSave(invoice);

            invoice = InvoiceService.InvoiceFetch(invoice.InvoiceId);

            invoice.Amount = DataHelper.RandomNumber(1000);

            invoice = InvoiceService.InvoiceSave(invoice);

            invoice = InvoiceService.InvoiceFetch(invoice.InvoiceId);

            Assert.IsTrue(invoice.Amount != 0, "Amount should have different value");
        }
Example #22
0
        public void Attachment_Edit()
        {
            var task       = BusinessHelper.CreateTask();
            var attachment = AttachmentService.AttachmentNew(SourceType.Task, task.TaskId);
            var name       = DataHelper.RandomString(100);

            attachment.Name     = name;
            attachment.FileType = DataHelper.RandomString(30);

            Assert.IsTrue(attachment.IsValid, string.Format("IsValid should be true, but has following errors: {0}", attachment.BrokenRulesCollection));

            attachment = AttachmentService.AttachmentSave(attachment);

            attachment = AttachmentService.AttachmentFetch(attachment.AttachmentId);

            attachment.Name = DataHelper.RandomString(100);

            attachment = AttachmentService.AttachmentSave(attachment);

            attachment = AttachmentService.AttachmentFetch(attachment.AttachmentId);

            Assert.IsTrue(attachment.Name != name, "Name should have different value");
        }
Example #23
0
        public void Attachment_Delete()
        {
            var task       = BusinessHelper.CreateTask();
            var attachment = AttachmentService.AttachmentNew(SourceType.Task, task.TaskId);

            attachment.Name     = DataHelper.RandomString(100);
            attachment.FileType = DataHelper.RandomString(30);

            attachment = AttachmentService.AttachmentSave(attachment);

            attachment = AttachmentService.AttachmentFetch(attachment.AttachmentId);

            AttachmentService.AttachmentDelete(attachment.AttachmentId);

            try
            {
                AttachmentService.AttachmentFetch(attachment.AttachmentId);
            }
            catch (Exception ex)
            {
                Assert.IsTrue(ex.GetBaseException() is InvalidOperationException);
            }
        }
Example #24
0
        public void Invoice_Fetch_List()
        {
            var invoice = InvoiceService.InvoiceNew();

            var task = BusinessHelper.CreateTask();

            invoice.Number      = DataHelper.RandomString(20);
            invoice.TaskId      = task.TaskId;
            invoice.Description = task.Description;

            InvoiceService.InvoiceSave(invoice);

            invoice = InvoiceService.InvoiceNew();

            invoice.Number      = DataHelper.RandomString(20);
            invoice.TaskId      = task.TaskId;
            invoice.Description = task.Description;

            InvoiceService.InvoiceSave(invoice);

            var invoices = InvoiceService.InvoiceFetchInfoList();

            Assert.IsTrue(invoices.Count > 1, "Invoices should be greater than one");
        }