Ejemplo n.º 1
0
        public void FetchChars_IchMinGreaterThanIchLim_Throws()
        {
            TsString tss = CreateTwoRunString();

            using (ArrayPtr rgch = MarshalEx.StringToNative(10, true))
                Assert.That(() => tss.FetchChars(25, 24, rgch), Throws.InstanceOf <ArgumentOutOfRangeException>());
        }
Ejemplo n.º 2
0
        public void FetchChars_OneRun_ReturnsCorrectString()
        {
            TsString tss = CreateOneRunString();

            using (ArrayPtr rgch = MarshalEx.StringToNative(6, true))
            {
                tss.FetchChars(1, 7, rgch);
                string str = MarshalEx.NativeToString(rgch, 6, true);
                Assert.That(str, Is.EqualTo("his is"));
            }
        }
Ejemplo n.º 3
0
        public void FetchChars_TwoRuns_ReturnsCorrectString()
        {
            TsString tss = CreateTwoRunString();

            using (ArrayPtr rgch = MarshalEx.StringToNative(11, true))
            {
                tss.FetchChars(25, 36, rgch);
                string str = MarshalEx.NativeToString(rgch, 11, true);
                Assert.That(str, Is.EqualTo("una prueba!"));
            }
        }
Ejemplo n.º 4
0
        public void FetchChars_Empty_ReturnsEmptyString()
        {
            TsString tss = CreateEmptyString();

            using (ArrayPtr rgch = MarshalEx.StringToNative(0, true))
            {
                tss.FetchChars(0, 0, rgch);
                string str = MarshalEx.NativeToString(rgch, 0, true);
                Assert.That(str, Is.EqualTo(string.Empty));
            }
        }
Ejemplo n.º 5
0
        public void FetchChars_ArrayIsNull_Throws()
        {
            TsString tss = CreateTwoRunString();

            Assert.That(() => tss.FetchChars(0, 5, ArrayPtr.Null), Throws.InstanceOf <ArgumentNullException>());
        }