public void Test_ToBoolean_UseNbo() { var converter = new DefaultConverter(); bool theBool = true; var bytes = BitConverter.GetBytes(theBool).Reverse().ToArray(); var actual = converter.ToBoolean(bytes, 0, true); const bool expected = true; Assert.AreEqual(expected, actual); }
public void Test_ToBoolean() { var converter = new DefaultConverter(); bool theBool = true; var bytes = BitConverter.GetBytes(theBool); var actual = converter.ToBoolean(bytes, 0, false); const bool expected = true; Assert.AreEqual(expected, actual); }
public void Test_ToBoolean(bool value, bool useNbo) { var converter = new DefaultConverter(); var bytes = BitConverter.GetBytes(value); if (useNbo) { bytes = bytes.Reverse().ToArray(); } var actual = converter.ToBoolean(bytes.AsSpan(), useNbo); Assert.Equal(value, actual); }