public void SetNoteTextTest() { // Arrange byte[] derivedKey = new byte[16] { 111, 222, 31, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 104, 15, 16 }; SymmetricKeyAlgorithm ska = SymmetricKeyAlgorithm.GenerateNew(SymmetricEncryptionAlgorithm.AES_CTR); string title = "Top three"; string text = "Another long and super boring text for testing purposes."; Note note = new Note(title, text); NoteSecret noteSecret = new NoteSecret(note, "does not matter", ska, derivedKey); string noteText1 = "Not so boring but still bit something text for test case"; // Act bool shouldBeTrue = noteSecret.SetNoteText(noteText1, derivedKey); string noteText2 = noteSecret.GetNoteText(derivedKey); bool shouldBeFalse = noteSecret.SetNoteText(noteText1, new byte[] { 1, 2, 3 }); // Assert Assert.IsTrue(shouldBeTrue); Assert.IsFalse(shouldBeFalse); Assert.IsFalse(string.IsNullOrEmpty(noteText2)); Assert.AreEqual(noteText1, noteText2); }