mirror of
https://github.com/LANCommander/RegParser.git
synced 2026-08-30 04:23:04 -04:00
47 lines
2.3 KiB
C#
47 lines
2.3 KiB
C#
using Xunit;
|
|
|
|
namespace RegParserDotNet.Tests
|
|
{
|
|
public class REG_BINARY
|
|
{
|
|
public const string Export =
|
|
@"[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Hasbro Interactive\Frogger\Save]
|
|
""keyboard 0""=hex:01,00,00,00,01,00,00,00,cb,00,00,00,cd,00,00,00,c8,00,00,00,\
|
|
d0,00,00,00,1c,00,00,00,9d,00,00,00,36,00,00,00,28,00,00,00,27,00,00,00,00,\
|
|
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
|
|
00,00,cb,00,00,00,cd,00,00,00,c8,00,00,00,d0,00,00,00,1c,00,00,00,9d,00,00,\
|
|
00,36,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,28,00,00,00,27,00,00,00,\
|
|
00,00,00,00,00,00,00,00,ff,ff,ff,ff";
|
|
|
|
[Theory]
|
|
[InlineData(Export)]
|
|
public void PropertyIsParseable(string input)
|
|
{
|
|
var parser = new RegParser();
|
|
var expectedBytes = new byte[]
|
|
{
|
|
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xcb, 0x00, 0x00, 0x00, 0xcd, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x9d, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcb, 0x00, 0x00, 0x00, 0xcd, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x9d, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
|
|
};
|
|
|
|
var keys = parser.Parse(input);
|
|
|
|
Assert.NotNull(keys);
|
|
Assert.NotEmpty(keys);
|
|
Assert.Equal(2, keys.Count());
|
|
Assert.Equal(keys.First().Path, keys.Last().Path);
|
|
|
|
var key = keys.Last();
|
|
|
|
var bytes = key.Value as byte[];
|
|
|
|
Assert.Equal(RegistryValueType.REG_BINARY, key.Type);
|
|
Assert.Equal("keyboard 0", key.Property);
|
|
Assert.Equal(expectedBytes.Length, bytes.Length);
|
|
|
|
for (var i = 0; i < expectedBytes.Length; i++)
|
|
{
|
|
Assert.Equal(expectedBytes[i], bytes[i]);
|
|
}
|
|
}
|
|
}
|
|
}
|