示例#1
0
        public void CanSaveEntry()
        {
            var entry = new JournalEntry("UnitTestEntry", "test title", "Ttiamus");
            JournalService entryService = new JournalService();

            var insertTask = entryService.CreateEntry(entry);

            Assert.IsTrue(insertTask.Result);
        }
示例#2
0
        public void CanDeleteEntry()
        {
            JournalService entryService = new JournalService();
            var entry = new JournalEntry("CanDeleteEntry test", "test title", "Ttiamus");
            entryService.CreateEntry(entry).Wait();

            var deleteEntryTask = entryService.DeleteEntry(entry.Id);
            deleteEntryTask.Wait();
            Assert.IsNull(entryService.GetEntry(entry.Id).Result);
        }
示例#3
0
        public void CanGetAllEntries()
        {
            JournalService entryService = new JournalService();

            var entryToInsert = new JournalEntry("CanGetAllEntries", "test title", "Ttiamus");
            entryService.CreateEntry(entryToInsert).Wait();

            var getAllEntryTask = entryService.GetEntries();
            var entries = getAllEntryTask.Result.ToList();
            Assert.IsTrue(entries.Count > 0);
        }
示例#4
0
        public void CanGetEntry()
        {
            JournalService entryService = new JournalService();

            var entryToInsert = new JournalEntry("UnitTestEntry", "test title", "Ttiamus");

            entryService.CreateEntry(entryToInsert).Wait();

            var entry = entryService.GetEntry(entryToInsert.Id).Result;

            Assert.IsTrue(string.Equals(entry.Id, entryToInsert.Id));
        }
示例#5
0
        public void CanGetTopEntries()
        {
            JournalService entryService = new JournalService();

            var entryToInsert = new JournalEntry("CanGetAllEntries", "test title", "Ttiamus");

            for (var i = 0; i <= 5; i++)
            {
                entryService.CreateEntry(entryToInsert).Wait();
            }

            var getAllEntryTask = entryService.GetEntries("Ttiamus", 0);
            var entries = getAllEntryTask.Result.ToList();
            Assert.IsTrue(entries.Count == 5);
        }
示例#6
0
        public void CanUpdateEntry()
        {
            JournalService entryService = new JournalService(); ;

            var entryToUpdate = new JournalEntry("Entry To Update", "test title", "Ttiamus");
            entryService.CreateEntry(entryToUpdate).Wait();

            var entry = new JournalEntry("CanUpdateEntryTest", "test title", "Ttiamus") {Id = entryToUpdate.Id };

            var updateEntryTask = entryService.UpdateEntry(entry);
            updateEntryTask.Wait();
            Assert.AreEqual("CanUpdateEntryTest", entryService.GetEntry(entryToUpdate.Id).Result.Body);
        }