modernuo/Projects/Server.Tests/Tests/Serialization/EnumConversionTests.cs
Kamron Batman 1a7e7c7c70
fix: Fixes spawner timer deserialization, decimal deserialization, and adds potion keg reverse lookup (#1711)
### Summary
* Fixes spawner timer deserialization
* Adds a check for a null timer and allows the timer to get recreated
* Adds PotionKeg reverse lookup
* Heavily optimizes decimal serialize/deserialize
2024-03-28 13:34:12 -07:00

21 lines
377 B
C#

using System;
using Xunit;
namespace Server.Tests;
public class EnumConversionTests
{
[Fact]
public void TestToEnum()
{
var e = ReadEnum<TileFlag>();
Assert.Equal(TileFlag.Container, e);
}
private static unsafe T ReadEnum<T>() where T : unmanaged, Enum
{
var num = (long)TileFlag.Container;
return *(T*)&num;
}
}