Cosmos/source/Cosmos.Core.VSTests/FieldOrderTests.cs
Matthijs ter Woord 675ce71d10 Ongoing work.
2015-07-31 08:34:28 -04:00

37 lines
1.3 KiB
C#

using System;
using System.Linq;
using System.Threading.Tasks;
using Cosmos.Debug.Common;
using Cosmos.IL2CPU;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Cosmos.Core.VSTests
{
[TestClass]
public class FieldOrderTests
{
// the memory stuff requires DataLookupEntry.DataBlock to be the first field
[TestMethod]
public unsafe void TestFieldOrderingOfDataLookupEntry()
{
ILOp.mPlugManager = new PlugManager(delegate(Exception exception)
{
throw new Exception("Error: " + exception.Message, exception);
});
using (var xDbg = new DebugInfo(":memory:", true))
{
try
{
var xInfo = ILOp.GetFieldsInfo(typeof(DataLookupEntry), false).OrderBy(i => i.Offset).ToArray();
Assert.IsNotNull(xInfo);
Assert.AreEqual(3, xInfo.Length);
Assert.AreEqual(nameof(DataLookupEntry.DataBlock), xInfo[0].Field.Name);
}
finally
{
ILOp.mPlugManager = null;
}
}
}
}
}