private static void RenderAndVerify(IMappingService mapSvc, RuntimeMap map, string fileName, string format) { using (var stream = mapSvc.RenderRuntimeMap(map, map.ViewCenter.X, map.ViewCenter.Y, map.ViewScale, map.DisplayWidth, map.DisplayHeight, map.DisplayDpi, format)) { using (var ms = new MemoryStream()) using (var ms2 = new MemoryStream()) using (var fs = new FileStream(fileName, FileMode.OpenOrCreate)) { Utility.CopyStream(stream, ms); Utility.CopyStream(ms, ms2); Utility.CopyStream(ms, fs); //See if System.Drawing.Image accepts this try { using (var img = System.Drawing.Image.FromStream(ms)) { } } catch (Exception ex) { Assert.Fail(ex.Message); } } } }