mirror of
https://gitlab.com/Syroot/Worms.git
synced 2025-04-14 21:22:29 +03:00
33 lines
1.1 KiB
C#
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);
|
|
}
|
|
}
|
|
}
|
|
}
|