Begin work on Unit Tests

This commit is contained in:
Li 2022-11-14 23:09:22 +13:00
parent cf7605c6c9
commit eaf1db1ee1
51 changed files with 3883 additions and 2101 deletions

View file

@ -1,27 +1,27 @@
using System.Threading;
namespace HISP.Security
{
public class RandomID
{
private static Mutex rndmIdMutex = new Mutex();
private static int prevId = 0;
public static int NextRandomId(int randomId=-1)
{
int rndmId = 0;
rndmIdMutex.WaitOne();
if (randomId == -1)
rndmId = prevId+1;
else
rndmId = randomId;
if (rndmId >= prevId)
namespace HISP.Security
{
public class RandomID
{
private static Mutex rndmIdMutex = new Mutex();
private static int prevId = 0;
public static int NextRandomId(int randomId=-1)
{
int rndmId = 0;
rndmIdMutex.WaitOne();
if (randomId == -1)
rndmId = prevId+1;
else
rndmId = randomId;
if (rndmId >= prevId)
prevId = rndmId;
rndmIdMutex.ReleaseMutex();
return rndmId;
}
}
}
rndmIdMutex.ReleaseMutex();
return rndmId;
}
}
}