public void SetLoginInformationPasswordTest() { // 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 newPassword = "******"; // Act string loginInformationPassword1 = loginInformationSecret.GetPassword(derivedKey); bool shouldBeTrue = loginInformationSecret.SetPassword(newPassword, derivedKey); string loginInformationPassword2 = loginInformationSecret.GetPassword(derivedKey); bool shouldBeFalse = loginInformationSecret.SetPassword(newPassword, new byte[] { 1, 2, 3 }); // Assert Assert.IsTrue(shouldBeTrue); Assert.IsFalse(shouldBeFalse); Assert.IsFalse(string.IsNullOrEmpty(loginInformationPassword1)); Assert.IsFalse(string.IsNullOrEmpty(loginInformationPassword2)); Assert.AreEqual(loginInformation.password, loginInformationPassword1); Assert.AreEqual(newPassword, loginInformationPassword2); }