2019-01-02 16:30:37 +01:00

33 lines
1.1 KiB
C#

using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Syroot.Worms.OnlineWorms;
namespace Syroot.Worms.Test.OnlineWorms
{
/// <summary>
/// Represents a collection of tests for the <see cref="LaunchConfig"/> class.
/// </summary>
[TestClass]
public class LaunchConfigTests
{
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
/// <summary>
/// Tests if encryptind and decrypting passwords yields the same results.
/// </summary>
[TestMethod]
public void CryptPassword()
{
LaunchConfig launchConfig = new LaunchConfig();
Random random = new Random(326988912);
foreach (string password in new[] { "Unknown123Test", "blablabl10235", "3252380", "SJDAKDFJS", "fdsklfj" })
{
uint key = (uint)random.Next(0, Int32.MaxValue);
launchConfig.SetPassword(password, key);
string decryptedPassword = launchConfig.GetPassword();
Assert.Equals(password, decryptedPassword);
}
}
}
}