Esempio n. 1
0
        public void Create_Unicode_Uncompressed()
        {
            var obj       = CreateLargeObject(2048, false);
            var stringObj = SqlLongString.Unicode(obj);

            Assert.IsNotNull(stringObj);
            Assert.IsFalse(stringObj.IsNull);
        }
Esempio n. 2
0
        public void WriteAndRead_Unicode()
        {
            const string testLine = "A simple test string that can span several characters, " +
                                    "that is trying to be the longest possible, just to prove" +
                                    "the capacity of a LONG VARCHAR to handle very long strings. " +
                                    "Anyway it is virtually impossible to reach the maximum size " +
                                    "of a long object, that is organized in 64k byte pages and " +
                                    "spans within the local system without any constraint of size. " +
                                    "For sake of memory anyway, the maximum size of the test object " +
                                    "is set to just 2048 bytes.";

            var obj = CreateLargeObject(2048, false);

            WriteToObject(obj, Encoding.Unicode, testLine);

            obj.Complete();

            var objId = obj.Id;

            var stringObj = SqlLongString.Unicode(obj);

            Assert.IsNotNull(stringObj);
            Assert.IsFalse(stringObj.IsNull);

            obj = GetLargeObject(objId);
            Assert.IsTrue(obj.IsComplete);
            Assert.IsFalse(obj.IsCompressed);

            stringObj = SqlLongString.Unicode(obj);
            var reader = stringObj.GetInput(Encoding.Unicode);

            Assert.IsNotNull(reader);

            string line = null;

            Assert.DoesNotThrow(() => line = reader.ReadLine());
            Assert.IsNotNull(line);
            Assert.IsNotEmpty(line);

            Assert.AreEqual(testLine, line);
        }