public void ReturnsDecryptedSecret() { // Arrange string secret = "mySecret"; int iterations = 1000; var encryptedSecret = new EncryptedSecret(secret, iterations); // Act var decryptedSecret = encryptedSecret.Decrypt(); // Assert Assert.Equal(secret, decryptedSecret); }
public void ConnectionIsSpecified_SetsLeaderboardsConnectionString() { // Arrange string[] args = { "--connection=myConnectionString" }; // Act parser.Parse(args, settings); // Assert var encrypted = new EncryptedSecret("myConnectionString", 1); Assert.Equal(encrypted.Decrypt(), settings.LeaderboardsConnectionString.Decrypt()); }
public void ConnectionFlagIsSpecified_PromptsUserForConnectionAndSetsLeaderboardsConnectionString() { // Arrange string[] args = { "--connection" }; mockInReader .SetupSequence(r => r.ReadLine()) .Returns("myConnectionString"); // Act parser.Parse(args, settings); // Assert var encrypted = new EncryptedSecret("myConnectionString", 1); Assert.Equal(encrypted.Decrypt(), settings.LeaderboardsConnectionString.Decrypt()); }
public void PasswordIsSpecified_SetsSteamPassword() { // Arrange string[] args = { "--password=myPassword" }; IDailyLeaderboardsSettings settings = new StubDailyLeaderboardsSettings { SteamUserName = "******", SteamPassword = new EncryptedSecret("a", 1), KeyDerivationIterations = 1, }; // Act parser.Parse(args, settings); // Assert var encrypted = new EncryptedSecret("myPassword", 1); Assert.Equal(encrypted.Decrypt(), settings.SteamPassword.Decrypt()); }
public void PasswordFlagIsSpecified_PromptsUserForPasswordAndSetsSteamPassword() { // Arrange string[] args = { "--password" }; IDailyLeaderboardsSettings settings = new StubDailyLeaderboardsSettings { SteamUserName = "******", SteamPassword = new EncryptedSecret("a", 1), KeyDerivationIterations = 1, }; mockInReader .SetupSequence(r => r.ReadLine()) .Returns("myPassword"); // Act parser.Parse(args, settings); // Assert var encrypted = new EncryptedSecret("myPassword", 1); Assert.Equal(encrypted.Decrypt(), settings.SteamPassword.Decrypt()); }