forked from fo-dicom/fo-dicom
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Exchanged use of FileInfo and DirectoryInfo. Issue fo-dicom#69
- Loading branch information
1 parent
9c788b0
commit 72aad33
Showing
5 changed files
with
79 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Copyright (c) 2012-2015 fo-dicom contributors. | ||
// Licensed under the Microsoft Public License (MS-PL). | ||
|
||
namespace Dicom.Printing | ||
{ | ||
using System.IO; | ||
|
||
using Xunit; | ||
|
||
public class FilmBoxTest | ||
{ | ||
#region Unit tests | ||
|
||
[Fact] | ||
public void Save_BasicFilmBox_CreatesRelevantFilesAndFolders() | ||
{ | ||
var path = @".\Test Data\Film Box Test 1"; | ||
if (Directory.Exists(path)) Directory.Delete(path, true); | ||
Directory.CreateDirectory(path); | ||
|
||
var session = new FilmSession(DicomUID.BasicFilmSessionSOPClass); | ||
var box = new FilmBox(session, null, DicomTransferSyntax.ImplicitVRLittleEndian); | ||
box.BasicImageBoxes.Add(new ImageBox(box, DicomUID.BasicGrayscaleImageBoxSOPClass, null)); | ||
box.Save(path); | ||
|
||
Assert.True(File.Exists(Path.Combine(path, "FilmBox.dcm"))); | ||
Assert.True(File.Exists(Path.Combine(path, "FilmBox.txt"))); | ||
Assert.True(Directory.Exists(Path.Combine(path, "Images"))); | ||
Assert.True(Directory.GetFiles(Path.Combine(path, "Images")).Length > 0); | ||
} | ||
|
||
[Fact] | ||
public void Load_BasicFilmBox_ExpectedSopClassFound() | ||
{ | ||
var path = @".\Test Data\Film Box Test 2"; | ||
if (Directory.Exists(path)) Directory.Delete(path, true); | ||
Directory.CreateDirectory(path); | ||
|
||
var expected = DicomUID.Generate(); | ||
|
||
var session = new FilmSession(DicomUID.BasicFilmSessionSOPClass); | ||
var box = new FilmBox(session, expected, DicomTransferSyntax.ImplicitVRLittleEndian); | ||
box.BasicImageBoxes.Add(new ImageBox(box, DicomUID.BasicGrayscaleImageBoxSOPClass, null)); | ||
box.Save(path); | ||
|
||
var loaded = FilmBox.Load(session, path); | ||
var actual = loaded.SOPInstanceUID; | ||
Assert.Equal(expected, actual); | ||
Assert.True(loaded.BasicImageBoxes.Count > 0); | ||
} | ||
|
||
#endregion | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters