public void Dispose_ClosesOutputStreamIfWritingToStream() { MemoryStream stream = new MemoryStream(); WktWriter target = new WktWriter(stream, new WktWriterSettings()); target.Dispose(); Assert.False(stream.CanRead); }
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(); }
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(); }