示例#1
0
        public void Dispose_ClosesOutputStreamIfWritingToStream()
        {
            MemoryStream stream = new MemoryStream();

            WktWriter target = new WktWriter(stream, new WktWriterSettings());

            target.Dispose();

            Assert.False(stream.CanRead);
        }
示例#2
0
        public void Dispose_ClosesOutputStreamIfWritingToFiles()
        {
            string filename = PathHelper.GetTempFilePath("wktwriter-closes-output-filestream-test.wkt");

            WktWriterSettings settings = new WktWriterSettings();
            WktWriter         target   = new WktWriter(filename, settings);

            target.Dispose();

            FileStream testStream = null;

            testStream = new FileStream(filename, FileMode.Open, FileAccess.ReadWrite);
            testStream.Dispose();
        }
示例#3
0
        public void Dispose_ClosesOutputStreamIfWritingToFiles()
        {
            string filename = "TestFiles\\wktwriter-closes-output-filestream-test.wkt";

            File.Delete(filename);

            WktWriterSettings settings = new WktWriterSettings();
            WktWriter         target   = new WktWriter(filename, settings);

            target.Dispose();

            FileStream testStream = null;

            Assert.DoesNotThrow(() => testStream = new FileStream(filename, FileMode.Open, FileAccess.ReadWrite));
            testStream.Dispose();
        }