Exemple #1
0
 public void StringToBStr_NullStringWorks()
 {
     //Act
     using (var target = SafeBStrHandle.StringToBStr(null))
     {
         //Assert
         target.Pointer.Should().BeZero();
         target.IsInvalid.Should().BeTrue();
     };
 }
Exemple #2
0
        public void ToString_ReturnsString()
        {
            var expected = "Hello";
            var target   = SafeBStrHandle.StringToBStr(expected);

            //Act
            var actual = target.ToString();

            //Assert
            actual.Should().Be(expected);
        }
Exemple #3
0
        public void StringToBStr_ValidStringWorks()
        {
            var str = "Hello";

            //Act
            using (var target = SafeBStrHandle.StringToBStr(str))
            {
                //Assert
                target.Pointer.Should().NotBeZero();
                target.IsInvalid.Should().BeFalse();

                AssertMemory(target.Pointer, Encoding.Unicode.GetBytes("Hello"));
            };
        }