public void StringToAnsi_NullStringWorks() { //Act using (var target = SafeHGlobalHandle.StringToAnsi(null)) { //Assert target.IsInvalid.Should().BeTrue(); target.Pointer.Should().BeZero(); }; }
public void StringToAnsi_ValidStringWorks() { string str = "Hello"; //Act using (var target = SafeHGlobalHandle.StringToAnsi(str)) { //Assert target.IsInvalid.Should().BeFalse(); AssertMemory(target.Pointer, Encoding.ASCII.GetBytes("Hello")); }; }