Beispiel #1
0
        public void CreateResponse()
        {
            Note   note   = SandboxProject.CreateNote("New Note", "This is a new Note", false);
            string noteId = note.ID;

            Note   response   = note.CreateResponse("A Response", "Back to you", true);
            string responseID = response.ID;

            ResetInstance();

            note     = Instance.Get.NoteByID(noteId);
            response = Instance.Get.NoteByID(responseID);

            Assert.IsTrue(note.Responses.Contains(response));

            Assert.AreEqual("A Response", response.Name);
            Assert.AreEqual("Back to you", response.Content);
            Assert.IsTrue(response.Personal);
            Assert.AreEqual(note, response.InResponseTo);

            ICollection <Note> notes = SandboxProject.GetNotes(null);

            Assert.IsTrue(notes.Contains(note));
            Assert.IsTrue(notes.Contains(response));
        }
        void TestInResponseTo(Note expected, Note not, Note expectedNote)
        {
            NoteFilter filter = new NoteFilter();

            filter.Asset.Add(SandboxProject);
            filter.InResponseTo.Add(expectedNote);

            ResetInstance();
            expected = Instance.Get.NoteByID(expected.ID);
            not      = Instance.Get.NoteByID(not.ID);

            ICollection <Note> results = SandboxProject.GetNotes(filter);

            Assert.IsTrue(FindRelated(expected, results), "Expected to find Note that matched filter.");
            Assert.IsFalse(FindRelated(not, results), "Expected to NOT find Note that doesn't match filter.");
            foreach (Note result in results)
            {
                Assert.AreEqual(expectedNote, result.InResponseTo);
            }
        }