public void StringToUnicode_ValidStringWorks() { string str = "Hello"; //Act using (var target = SafeHGlobalHandle.StringToUnicode(str)) { //Assert target.IsInvalid.Should().BeFalse(); AssertMemory(target.Pointer, Encoding.Unicode.GetBytes("Hello")); }; }