Пример #1
0
        public void ModificationUpdateTimestampTest()
        {
            // Arrange
            Note note = new Note("Some topic here", "Some text here, yes.");

            // Act
            var modificationTime1 = note.modificationTime;

            System.Threading.Thread.Sleep(1100);
            note.UpdateNote(note.GetNoteTitle(), "Some text here, yes. part 2");
            var modificationTime2 = note.modificationTime;

            // Assert
            Assert.AreNotEqual(modificationTime1, modificationTime2);
        }
Пример #2
0
        public void ChecksumChangesTest()
        {
            // Arrange
            DateTimeOffset dto   = DateTimeOffset.UtcNow;
            Note           note1 = new Note();
            Note           note2 = new Note("Some topic here", "Some text here, yes.", dto);
            Note           note3 = new Note("Some topic here", "Some text here, yes.", dto);

            // Act
            string checksum1 = note1.GetChecksumAsHex();
            string checksum2 = note2.GetChecksumAsHex();
            string checksum3 = note3.GetChecksumAsHex();

            string newContent = note3.GetNoteText() + "A";

            note3.UpdateNote(note3.GetNoteTitle(), newContent);
            string checksum4 = note3.GetChecksumAsHex();

            // Assert
            Assert.AreNotEqual(checksum1, checksum2);
            Assert.AreEqual(checksum3, checksum2);
            Assert.AreNotEqual(checksum3, checksum4);
        }