예제 #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 = "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();
        }