Пример #1
0
        public void Utf8Test(string path)
        {
            UTF8Encoding encoding = new UTF8Encoding(false, true);

            Assert.True(Curl.Initialize());
            using (Curl curl = new Curl())
            {
                Assert.Equal(File.ReadAllText(path, encoding), curl.GetText(new Uri(Path.GetFullPath(path)).AbsoluteUri, encoding));
            }
            Curl.Deinitialize();
        }
Пример #2
0
        public void Ucs2BeBomTest(string path)
        {
            UnicodeEncoding encoding = new UnicodeEncoding(true, true, true);

            Assert.True(Curl.Initialize());
            using (Curl curl = new Curl())
            {
                curl.UseBom = true;
                Assert.Equal(File.ReadAllText(path, encoding), curl.GetText(new Uri(Path.GetFullPath(path)).AbsoluteUri, encoding));
            }
            Curl.Deinitialize();
        }
Пример #3
0
        public void InvalidEncodingTest(string path)
        {
            UTF8Encoding encoding = new UTF8Encoding(false, true);

            Assert.True(Curl.Initialize());
            Assert.Throws <DecoderFallbackException>(() =>
            {
                using (Curl curl = new Curl())
                {
                    curl.GetText(new Uri(Path.GetFullPath(path)).AbsoluteUri, encoding);
                }
            });
            Curl.Deinitialize();
        }
Пример #4
0
 public void Dispose()
 {
     Curl.Deinitialize();
 }
Пример #5
0
 public void InitializeTest()
 {
     Assert.True(Curl.Initialize());
     Curl.Deinitialize();
 }