public void DecodeNativeBuffer_Returns_Expected_ASCII_Value_For_Empty_String() { // Arrange var buffer = new byte[] { 0, 0, 0, 0, 0 }; // Act var actual = InteropHelper.DecodeNativeBuffer(buffer, Encoding.ASCII); // Assert Assert.Equal("", actual); }
public void DecodeNativeBuffer_Returns_Expected_ASCII_Value() { // Arrange var buffer = new byte[] { 97, 98, 99, 0, 0 }; // Act var actual = InteropHelper.DecodeNativeBuffer(buffer, Encoding.ASCII); // Assert Assert.Equal("abc", actual); }
public void DecodeNativeBuffer_Returns_Expected_UTF16_Value() { // Arrange var buffer = new byte[] { 97, 0, 98, 0, 0, 0 }; // Act var actual = InteropHelper.DecodeNativeBuffer(buffer, Encoding.Unicode); // Assert Assert.Equal("ab", actual); }
public void DecodeNativeBuffer_Returns_Expected_UTF8_Value_For_Max_Buffer_Length() { // Arrange var buffer = new byte[] { 97, 98, 99, 100, 101 }; // Act var actual = InteropHelper.DecodeNativeBuffer(buffer, Encoding.UTF8); // Assert Assert.Equal("abcde", actual); }
public void DecodeNativeBuffer_Returns_Expected_UTF32_Value() { // Arrange // 4 bytes per character var buffer = new byte[] { 97, 0, 0, 0, 0 }; // Act var actual = InteropHelper.DecodeNativeBuffer(buffer, Encoding.UTF32); // Assert Assert.Equal("a", actual); }