Exemplo n.º 1
0
        public void UpdateProjectUsers()
        {
            if (!Settings.ModifyTests)
            {
                return;
            }
            ApiList <Person> people = Person.GetPeopleOnProject(Api, Settings.TestProject).Result;

            if (people.All(Api).Any(p => p.id == Settings.TestUser2))
            {
                Person.UpdateProjectUsers(Api, Settings.TestProject, new UpdateProjectUsersList()
                {
                    revoke = new long[] { Settings.TestUser2 }
                }).Wait();
            }
            UpdateProjectUsersResult result = RunTest(Person.UpdateProjectUsers(Api, Settings.TestProject, new UpdateProjectUsersList()
            {
                grant = new long[] { Settings.TestUser2 }
            }));

            Assert.IsTrue(result.granted.Length == 0 || result.granted[0].id == Settings.TestUser2);
            people = Person.GetPeopleOnProject(Api, Settings.TestProject).Result;
            Assert.IsTrue(people.All(Api).Any(p => p.id == Settings.TestUser2));
            result = RunTest(Person.UpdateProjectUsers(Api, Settings.TestProject, new UpdateProjectUsersList()
            {
                revoke = new long[] { Settings.TestUser2 }
            }));
            Assert.AreEqual(Settings.TestUser2, result.revoked[0].id);
            people = Person.GetPeopleOnProject(Api, Settings.TestProject).Result;
            Assert.IsFalse(people.All(Api).Any(p => p.id == Settings.TestUser2));
        }
Exemplo n.º 2
0
        public void GetPingablePeople()
        {
            ApiList <Person> people = RunTest(Person.GetPingablePeople(Api));
            Person           psn    = people.All(Api).FirstOrDefault(p => p.id == Settings.TestUser);

            psn = people.All(Api).FirstOrDefault(p => p.id == Settings.TestUser2);
            List <Person> all = people.All(Api).ToList();

            Assert.IsTrue(all.Any(p => p.id == Settings.TestUser));
            Assert.IsTrue(all.Any(p => p.id == Settings.TestUser2));
        }
Exemplo n.º 3
0
        public void CreateAndDeleteLine()
        {
            if (!Settings.ModifyTests)
            {
                return;
            }
            Campfire               c     = Campfire.GetCampfire(Api, Settings.TestProject, Settings.TestCampfire).Result;
            CampfireLine           l     = c.CreateLine(Api, "Test Campfire Line").Result;
            ApiList <CampfireLine> lines = RunTest(c.GetLines(Api));

            Assert.IsTrue(lines.All(Api).Any(ln => ln.id == l.id));
            RunTest(l.Delete(Api));
            lines = RunTest(c.GetLines(Api));
            Assert.IsFalse(lines.All(Api).Any(ln => ln.id == l.id));
        }
Exemplo n.º 4
0
        public void GetLines()
        {
            Campfire c = Campfire.GetCampfire(Api, Settings.TestProject, Settings.TestCampfire).Result;
            ApiList <CampfireLine> lines = RunTest(c.GetLines(Api));

            Assert.IsTrue(lines.All(Api).Any(l => l.id == Settings.TestCampfireLine));
        }
Exemplo n.º 5
0
        public void GetMessages()
        {
            MessageBoard      b        = MessageBoard.GetMessageBoard(Api, Settings.TestProject, Settings.TestMessageBoard).Result;
            ApiList <Message> messages = RunTest(b.GetMessages(Api));

            Assert.IsTrue(messages.All(Api).Any(m => m.id == Settings.TestMessage));
        }
Exemplo n.º 6
0
        public void GetMessageTypes()
        {
            ApiList <MessageType> messageTypes = RunTest(MessageType.GetMessageTypes(Api, Settings.TestProject));

            Assert.IsTrue(messageTypes.All(Api).Any(m => m.id == Settings.AnnouncementMessageType));
            ;
        }
Exemplo n.º 7
0
        public void CreateModifyDeleteMessageType()
        {
            if (!Settings.ModifyTests)
            {
                return;
            }
            string name  = "Test message type";
            string icon  = "t";
            string name2 = "Altered message type";
            string icon2 = "a";
            ApiList <MessageType> messages = RunTest(MessageType.GetMessageTypes(Api, Settings.TestProject));
            List <MessageType>    all      = messages.All(Api).ToList();
            MessageType           d        = all.FirstOrDefault(x => x.name == name);

            if (d != null)
            {
                d.Destroy(Api, Settings.TestProject).Wait();
            }
            d = all.FirstOrDefault(x => x.name == name2);
            if (d != null)
            {
                d.Destroy(Api, Settings.TestProject).Wait();
            }
            MessageType m = MessageType.Create(Api, Settings.TestProject, name, icon).Result;

            Assert.AreEqual(name, m.name);
            Assert.AreEqual(icon, m.icon);
            MessageType changed = m.Update(Api, Settings.TestProject, name2, icon2).Result;

            Assert.AreEqual(name2, changed.name);
            Assert.AreEqual(icon2, changed.icon);
            changed.Destroy(Api, Settings.TestProject).Wait();
        }
Exemplo n.º 8
0
        public void GetScheduleEntriesFromSchedule()
        {
            Schedule s = Schedule.GetSchedule(Api, Settings.TestProject, Settings.TestSchedule).Result;
            ApiList <ScheduleEntry> entries = RunTest(s.GetScheduleEntries(Api));

            Assert.IsTrue(entries.All(Api).Any(e => e.id == Settings.TestEvent));
        }
Exemplo n.º 9
0
        public void GetComments()
        {
            MessageBoard      b        = MessageBoard.GetMessageBoard(Api, Settings.TestProject, Settings.TestMessageBoard).Result;
            Message           m        = b.GetMessage(Api, Settings.TestMessage).Result;
            ApiList <Comment> comments = RunTest(m.GetComments(Api));

            Assert.IsTrue(comments.All(Api).Any(c => c.id == Settings.TestComment));
        }
Exemplo n.º 10
0
        public void GetPeopleOnProject()
        {
            ApiList <Person> people = RunTest(Person.GetPeopleOnProject(Api, Settings.TestProject));
            List <Person>    all    = people.All(Api).ToList();

            Assert.IsTrue(all.Any(p => p.id == Settings.LoginUser));
            Assert.IsTrue(all.Any(p => p.id == Settings.TestUser));
        }
Exemplo n.º 11
0
        public void GetAllPeople()
        {
            ApiList <Person> people = RunTest(Person.GetAllPeople(Api));
            List <Person>    all    = people.All(Api).ToList();

            Assert.IsTrue(all.Any(p => p.id == Settings.TestUser));
            Assert.IsTrue(all.Any(p => p.id == Settings.TestUser2));
        }
Exemplo n.º 12
0
        public static void ShowList <T>(Task <ApiList <T> > task)
        {
            ApiList <T> result = RunTest(task);

            foreach (T o in result.All(Api))
            {
                Console.WriteLine(o);
            }
        }
Exemplo n.º 13
0
        public static void ShowList <T, L>(Task <L> task) where T : new() where  L : ApiList <T>
        {
            ApiList <T> result = RunTest(task);

            foreach (T o in result.All(Api))
            {
                Console.WriteLine(o);
            }
        }
Exemplo n.º 14
0
        public void CreateProjectAndTrash()
        {
            if (!Settings.DestructiveTests)
            {
                return;
            }
            Project p = Project.CreateProject(Api, "Nikki Test 2").Result;

            RunTest(p.Trash(Api));
            ApiList <Project> projects = RunTest(Project.GetAllProjects(Api, Status.trashed));

            Assert.IsTrue(projects.All(Api).Any(t => t.id == p.id));
        }
Exemplo n.º 15
0
        public void GetScheduleEntries()
        {
            ApiList <ScheduleEntry> entries = RunTest(ScheduleEntry.GetScheduleEntries(Api, Settings.TestProject, Settings.TestSchedule));

            Assert.IsTrue(entries.All(Api).Any(e => e.id == Settings.TestEvent));
        }
Exemplo n.º 16
0
        public void GetAllQuestions()
        {
            ApiList <Question> list = RunTest(Question.GetAllQuestions(Api, Settings.TestProject, Settings.TestQuestionnaire));

            Assert.IsTrue(list.All(Api).Any(q => q.id == Settings.TestQuestion));
        }
Exemplo n.º 17
0
        public void GetAnswers()
        {
            ApiList <QuestionAnswer> answers = RunTest(QuestionAnswer.GetAllQuestionAnswers(Api, Settings.TestProject, Settings.TestQuestion));

            Assert.IsTrue(answers.All(Api).Any(a => a.id == Settings.TestAnswer));
        }
Exemplo n.º 18
0
        public void GetAllProjects()
        {
            ApiList <Project> projects = RunTest(Project.GetAllProjects(Api));

            Assert.IsTrue(projects.All(Api).Any(p => p.id == Settings.TestProject));
        }
Exemplo n.º 19
0
        public void GetAllToDoLists()
        {
            ApiList <ToDoList> lists = RunTest(ToDoList.GetAllToDoLists(Api, Settings.TestProject, Settings.TestToDoSet));

            Assert.IsTrue(lists.All(Api).Any(l => l.id == Settings.TestToDoList));
        }
Exemplo n.º 20
0
        public void GetAllToDoListGroups()
        {
            ApiList <ToDoListGroup> groups = RunTest(ToDoListGroup.GetAllToDoListGroups(Api, Settings.TestProject, Settings.TestToDoList));

            Assert.IsTrue(groups.All(Api).Any(g => g.id == Settings.TestToDoListGroup));
        }
Exemplo n.º 21
0
        public void GetAllCampfires()
        {
            ApiList <Campfire> campfires = RunTest(Campfire.GetAllCampfires(Api));

            Assert.IsTrue(campfires.All(Api).Any(c => c.id == Settings.TestCampfire));
        }