public void SetLoginInformationCreationTimeTest() { // 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); DateTimeOffset newCreationTime = DateTimeOffset.UtcNow.AddDays(1); // Act DateTimeOffset loginInformationCreationTime1 = loginInformationSecret.GetCreationTime(derivedKey); bool shouldBeTrue = loginInformationSecret.SetCreationTime(newCreationTime, derivedKey); DateTimeOffset loginInformationCreationTime2 = loginInformationSecret.GetCreationTime(derivedKey); bool shouldBeFalse = loginInformationSecret.SetCreationTime(newCreationTime, new byte[] { 1, 29, 3 }); // Assert Assert.IsTrue(shouldBeTrue); Assert.IsFalse(shouldBeFalse); Assert.AreEqual(loginInformation.creationTime, loginInformationCreationTime1.ToUnixTimeSeconds()); Assert.AreEqual(newCreationTime.ToUnixTimeSeconds(), loginInformationCreationTime2.ToUnixTimeSeconds()); }