Пример #1
0
        public void DiaryEntryToFileContent_AndBack_Basic()
        {
            var diaryEntry = CreateDiaryEntry();

            var diaryEntryString = DiaryEntryFileFormat.DiaryEntryToFileContent(diaryEntry);
            var recreatedEntry   = DiaryEntryFileFormat.FileContentToDiaryEntry(diaryEntryString.Split(new[] { "\r\n" }, StringSplitOptions.None));

            Assert.AreEqual(diaryEntry.Id, recreatedEntry.Id);
            Assert.AreEqual(diaryEntry.Date, recreatedEntry.Date);
            Assert.AreEqual(diaryEntry.Title, recreatedEntry.Title);
            Assert.AreEqual(diaryEntry.Text, recreatedEntry.Text);
            Assert.AreEqual(diaryEntry.Thoughts, recreatedEntry.Thoughts);
        }
Пример #2
0
        public void DiaryEntryToFileContent_AndBack_SomeFieldsCanBeEmpty()
        {
            var diaryEntry = CreateDiaryEntry();

            diaryEntry.Title    = string.Empty;
            diaryEntry.Text     = string.Empty;
            diaryEntry.Thoughts = string.Empty;
            diaryEntry.Tags     = new List <string>();

            var diaryEntryString = DiaryEntryFileFormat.DiaryEntryToFileContent(diaryEntry);
            var recreatedEntry   = DiaryEntryFileFormat.FileContentToDiaryEntry(diaryEntryString.Split(new[] { "\r\n" }, StringSplitOptions.None));

            Assert.AreEqual(diaryEntry.Id, recreatedEntry.Id);
            Assert.AreEqual(diaryEntry.Date, recreatedEntry.Date);
            Assert.AreEqual(diaryEntry.Title, recreatedEntry.Title);
            Assert.AreEqual(diaryEntry.Text, recreatedEntry.Text);
            Assert.AreEqual(diaryEntry.Thoughts, recreatedEntry.Thoughts);
        }
Пример #3
0
        public void FileContentToDiaryEntry_PassingNullReturnsNull()
        {
            var recreatedEntry = DiaryEntryFileFormat.FileContentToDiaryEntry(null);

            Assert.AreEqual(null, recreatedEntry);
        }
Пример #4
0
        public void FileContentToDiaryEntry_PassingEmptyArrayReturnsNull()
        {
            var recreatedEntry = DiaryEntryFileFormat.FileContentToDiaryEntry(new string[] { });

            Assert.AreEqual(null, recreatedEntry);
        }