Beispiel #1
0
        public void TestGetSafeLockNameCompat()
        {
            SqlDistributedReaderWriterLock.MaxLockNameLength.ShouldEqual(SqlDistributedLock.MaxLockNameLength);

            var cases = new[]
            {
                string.Empty,
                "abc",
                "\\",
                new string('a', SqlDistributedLock.MaxLockNameLength),
                new string('\\', SqlDistributedLock.MaxLockNameLength),
                new string('x', SqlDistributedLock.MaxLockNameLength + 1)
            };

            foreach (var lockName in cases)
            {
                // should be compatible with SqlDistributedLock
                SqlDistributedReaderWriterLock.GetSafeLockName(lockName).ShouldEqual(SqlDistributedLock.GetSafeLockName(lockName));
            }
        }
Beispiel #2
0
 internal override string GetSafeLockName(string name) => SqlDistributedReaderWriterLock.GetSafeLockName(name);
 private static string UniqueSafeLockName(string baseName) =>
 SqlDistributedReaderWriterLock.GetSafeLockName($"{baseName}_{TestHelper.FrameworkName}");