mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-07-18 11:34:46 +01:00
Fix RightsHelper.AllRights add test
This commit is contained in:
@@ -79,11 +79,11 @@ namespace Tgstation.Server.Api.Rights
|
||||
public static TRight AllRights<TRight>() where TRight : Enum
|
||||
{
|
||||
ulong rights = 0;
|
||||
Type rightsType = typeof(TRight);
|
||||
foreach (Enum J in Enum.GetValues(rightsType))
|
||||
rights = rights | Convert.ToUInt64(J, CultureInfo.InvariantCulture);
|
||||
foreach (Enum J in Enum.GetValues(typeof(TRight)))
|
||||
rights |= Convert.ToUInt64(J, CultureInfo.InvariantCulture);
|
||||
|
||||
return (TRight)Convert.ChangeType(rights, rightsType, CultureInfo.InvariantCulture);
|
||||
// cri evertim
|
||||
return (TRight)(object)rights;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,5 +36,14 @@ namespace Tgstation.Server.Api.Rights.Tests
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestAllRightsWorks()
|
||||
{
|
||||
var allByondRights = ByondRights.CancelInstall | ByondRights.ChangeVersion | ByondRights.ListInstalled | ByondRights.ReadActive;
|
||||
var automaticByondRights = RightsHelper.AllRights<ByondRights>();
|
||||
|
||||
Assert.AreEqual(allByondRights, automaticByondRights);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user