public void SetLoginInformationTitleTest() { // 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); LoginInformationSecret loginInformationSecret = new LoginInformationSecret(loginInformation, "does not matter", ska, derivedKey); string newTitle = "new and fresh!"; // Act string loginInformationTitle1 = loginInformationSecret.GetTitle(derivedKey); bool shouldBeTrue = loginInformationSecret.SetTitle(newTitle, derivedKey); string loginInformationTitle2 = loginInformationSecret.GetTitle(derivedKey); bool shouldBeFalse = loginInformationSecret.SetTitle(newTitle, new byte[] { 1, 2, 3 }); // Assert Assert.IsTrue(shouldBeTrue); Assert.IsFalse(shouldBeFalse); Assert.IsFalse(string.IsNullOrEmpty(loginInformationTitle1)); Assert.IsFalse(string.IsNullOrEmpty(loginInformationTitle2)); Assert.AreEqual(loginInformation.title, loginInformationTitle1); Assert.AreEqual(newTitle, loginInformationTitle2); }