public void SaveReadHashKeyWith_SaveHashKey_ReadHashKey() { string password = "******"; var aHash = NotebookCryptography.GetHash(password); var aKey = NotebookCryptography.GenerateKey(); Assert.IsTrue(NotebookModelIO.SaveHashKey(aHash, aKey)); var extractHash = NotebookModelIO.ReadHashKey(true); var extractKey = NotebookModelIO.ReadHashKey(false); CollectionAssert.AreEqual(aHash, extractHash); CollectionAssert.AreEqual(aKey, extractKey); }
public void SaveReadNotesWith_Serialize_Deserialize() { var source = new ModelSource(); source.AddNote("example", "it's a note"); ConstantKeeper.SetKey(NotebookCryptography.GenerateKey()); ConstantKeeper.SetIV(NotebookCryptography.GenerateIV()); source.SerializeNotes(); source.DeSerializeNotes(); var result = source.Notes; var name = result[0].Name; var txt = result[0].Txt; Assert.IsTrue(result.Count == 1); Assert.IsTrue(name == "example"); Assert.IsTrue(txt == "it's a note"); }