Skip to content
Browse files

Addedu nit test project to prepare for DicomTag refactoring

  • Loading branch information...
1 parent cadaa9e commit ba5bce1780722a2bd86f3f1115a7ee6012be78d9 @anders9ustafsson anders9ustafsson committed
View
3 .gitignore
@@ -12,4 +12,5 @@ Release/
TestResult.xml
*.StyleCop
ipch/
-Distribute/
+Distribute/
+packages/
View
60 DICOM.sln
@@ -42,63 +42,123 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "C-Store SCP", "Examples\C-S
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DICOM Dump", "Examples\DICOM Dump\DICOM Dump.csproj", "{8C433ABF-AFE5-4A76-BEBC-74116EC3460E}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DICOMTests", "DICOMTests\DICOMTests.csproj", "{6D11A4EE-DB7F-4DDD-A3ED-46A7E9D331DE}"
+EndProject
Global
GlobalSection(TestCaseManagementSettings) = postSolution
CategoryFile = DICOM.vsmdi
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
+ Debug|Mixed Platforms = Debug|Mixed Platforms
Release|Any CPU = Release|Any CPU
+ Release|Mixed Platforms = Release|Mixed Platforms
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D6E309B0-4837-459E-8C85-ABC268440D62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D6E309B0-4837-459E-8C85-ABC268440D62}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D6E309B0-4837-459E-8C85-ABC268440D62}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {D6E309B0-4837-459E-8C85-ABC268440D62}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{D6E309B0-4837-459E-8C85-ABC268440D62}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D6E309B0-4837-459E-8C85-ABC268440D62}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D6E309B0-4837-459E-8C85-ABC268440D62}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {D6E309B0-4837-459E-8C85-ABC268440D62}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{16FD143D-6E25-4CD9-AEC0-B096644B0045}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{16FD143D-6E25-4CD9-AEC0-B096644B0045}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {16FD143D-6E25-4CD9-AEC0-B096644B0045}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {16FD143D-6E25-4CD9-AEC0-B096644B0045}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{16FD143D-6E25-4CD9-AEC0-B096644B0045}.Release|Any CPU.ActiveCfg = Release|Any CPU
{16FD143D-6E25-4CD9-AEC0-B096644B0045}.Release|Any CPU.Build.0 = Release|Any CPU
+ {16FD143D-6E25-4CD9-AEC0-B096644B0045}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {16FD143D-6E25-4CD9-AEC0-B096644B0045}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{8DC28743-3826-453A-B400-B0AE7B2C04E7}.Debug|Any CPU.ActiveCfg = Debug|Win32
{8DC28743-3826-453A-B400-B0AE7B2C04E7}.Debug|Any CPU.Build.0 = Debug|Win32
+ {8DC28743-3826-453A-B400-B0AE7B2C04E7}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
+ {8DC28743-3826-453A-B400-B0AE7B2C04E7}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{8DC28743-3826-453A-B400-B0AE7B2C04E7}.Release|Any CPU.ActiveCfg = Release|Win32
{8DC28743-3826-453A-B400-B0AE7B2C04E7}.Release|Any CPU.Build.0 = Release|Win32
+ {8DC28743-3826-453A-B400-B0AE7B2C04E7}.Release|Mixed Platforms.ActiveCfg = Release|Win32
+ {8DC28743-3826-453A-B400-B0AE7B2C04E7}.Release|Mixed Platforms.Build.0 = Release|Win32
{0331D451-7C7A-4DB7-A11D-61708F2E8D05}.Debug|Any CPU.ActiveCfg = Debug|Win32
{0331D451-7C7A-4DB7-A11D-61708F2E8D05}.Debug|Any CPU.Build.0 = Debug|Win32
+ {0331D451-7C7A-4DB7-A11D-61708F2E8D05}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
+ {0331D451-7C7A-4DB7-A11D-61708F2E8D05}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{0331D451-7C7A-4DB7-A11D-61708F2E8D05}.Release|Any CPU.ActiveCfg = Release|Win32
{0331D451-7C7A-4DB7-A11D-61708F2E8D05}.Release|Any CPU.Build.0 = Release|Win32
+ {0331D451-7C7A-4DB7-A11D-61708F2E8D05}.Release|Mixed Platforms.ActiveCfg = Release|Win32
+ {0331D451-7C7A-4DB7-A11D-61708F2E8D05}.Release|Mixed Platforms.Build.0 = Release|Win32
{63088DEC-9F99-404C-B4E8-D823D2A0018F}.Debug|Any CPU.ActiveCfg = Debug|Win32
{63088DEC-9F99-404C-B4E8-D823D2A0018F}.Debug|Any CPU.Build.0 = Debug|Win32
+ {63088DEC-9F99-404C-B4E8-D823D2A0018F}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
+ {63088DEC-9F99-404C-B4E8-D823D2A0018F}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{63088DEC-9F99-404C-B4E8-D823D2A0018F}.Release|Any CPU.ActiveCfg = Release|Win32
{63088DEC-9F99-404C-B4E8-D823D2A0018F}.Release|Any CPU.Build.0 = Release|Win32
+ {63088DEC-9F99-404C-B4E8-D823D2A0018F}.Release|Mixed Platforms.ActiveCfg = Release|Win32
+ {63088DEC-9F99-404C-B4E8-D823D2A0018F}.Release|Mixed Platforms.Build.0 = Release|Win32
{808528F3-15DC-4CC6-A15A-0F91CBDB54E6}.Debug|Any CPU.ActiveCfg = Debug|x64
{808528F3-15DC-4CC6-A15A-0F91CBDB54E6}.Debug|Any CPU.Build.0 = Debug|x64
+ {808528F3-15DC-4CC6-A15A-0F91CBDB54E6}.Debug|Mixed Platforms.ActiveCfg = Debug|x64
+ {808528F3-15DC-4CC6-A15A-0F91CBDB54E6}.Debug|Mixed Platforms.Build.0 = Debug|x64
{808528F3-15DC-4CC6-A15A-0F91CBDB54E6}.Release|Any CPU.ActiveCfg = Release|x64
{808528F3-15DC-4CC6-A15A-0F91CBDB54E6}.Release|Any CPU.Build.0 = Release|x64
+ {808528F3-15DC-4CC6-A15A-0F91CBDB54E6}.Release|Mixed Platforms.ActiveCfg = Release|x64
+ {808528F3-15DC-4CC6-A15A-0F91CBDB54E6}.Release|Mixed Platforms.Build.0 = Release|x64
{1B3557D4-1146-428A-AEC9-12CADF994527}.Debug|Any CPU.ActiveCfg = Debug|x64
{1B3557D4-1146-428A-AEC9-12CADF994527}.Debug|Any CPU.Build.0 = Debug|x64
+ {1B3557D4-1146-428A-AEC9-12CADF994527}.Debug|Mixed Platforms.ActiveCfg = Debug|x64
+ {1B3557D4-1146-428A-AEC9-12CADF994527}.Debug|Mixed Platforms.Build.0 = Debug|x64
{1B3557D4-1146-428A-AEC9-12CADF994527}.Release|Any CPU.ActiveCfg = Release|x64
{1B3557D4-1146-428A-AEC9-12CADF994527}.Release|Any CPU.Build.0 = Release|x64
+ {1B3557D4-1146-428A-AEC9-12CADF994527}.Release|Mixed Platforms.ActiveCfg = Release|x64
+ {1B3557D4-1146-428A-AEC9-12CADF994527}.Release|Mixed Platforms.Build.0 = Release|x64
{DD846D57-B93B-46C8-BFFF-AE4C11E408B3}.Debug|Any CPU.ActiveCfg = Debug|x64
{DD846D57-B93B-46C8-BFFF-AE4C11E408B3}.Debug|Any CPU.Build.0 = Debug|x64
+ {DD846D57-B93B-46C8-BFFF-AE4C11E408B3}.Debug|Mixed Platforms.ActiveCfg = Debug|x64
+ {DD846D57-B93B-46C8-BFFF-AE4C11E408B3}.Debug|Mixed Platforms.Build.0 = Debug|x64
{DD846D57-B93B-46C8-BFFF-AE4C11E408B3}.Release|Any CPU.ActiveCfg = Release|x64
{DD846D57-B93B-46C8-BFFF-AE4C11E408B3}.Release|Any CPU.Build.0 = Release|x64
+ {DD846D57-B93B-46C8-BFFF-AE4C11E408B3}.Release|Mixed Platforms.ActiveCfg = Release|x64
+ {DD846D57-B93B-46C8-BFFF-AE4C11E408B3}.Release|Mixed Platforms.Build.0 = Release|x64
{FA9C7678-B9D9-46BC-8921-8152FD6787CA}.Debug|Any CPU.ActiveCfg = Debug|x64
{FA9C7678-B9D9-46BC-8921-8152FD6787CA}.Debug|Any CPU.Build.0 = Debug|x64
+ {FA9C7678-B9D9-46BC-8921-8152FD6787CA}.Debug|Mixed Platforms.ActiveCfg = Debug|x64
+ {FA9C7678-B9D9-46BC-8921-8152FD6787CA}.Debug|Mixed Platforms.Build.0 = Debug|x64
{FA9C7678-B9D9-46BC-8921-8152FD6787CA}.Release|Any CPU.ActiveCfg = Release|x64
{FA9C7678-B9D9-46BC-8921-8152FD6787CA}.Release|Any CPU.Build.0 = Release|x64
+ {FA9C7678-B9D9-46BC-8921-8152FD6787CA}.Release|Mixed Platforms.ActiveCfg = Release|x64
+ {FA9C7678-B9D9-46BC-8921-8152FD6787CA}.Release|Mixed Platforms.Build.0 = Release|x64
{C6148839-334D-4894-BDB9-E2D57438CF8A}.Debug|Any CPU.ActiveCfg = Debug|Win32
{C6148839-334D-4894-BDB9-E2D57438CF8A}.Debug|Any CPU.Build.0 = Debug|Win32
+ {C6148839-334D-4894-BDB9-E2D57438CF8A}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
+ {C6148839-334D-4894-BDB9-E2D57438CF8A}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{C6148839-334D-4894-BDB9-E2D57438CF8A}.Release|Any CPU.ActiveCfg = Release|Win32
{C6148839-334D-4894-BDB9-E2D57438CF8A}.Release|Any CPU.Build.0 = Release|Win32
+ {C6148839-334D-4894-BDB9-E2D57438CF8A}.Release|Mixed Platforms.ActiveCfg = Release|Win32
+ {C6148839-334D-4894-BDB9-E2D57438CF8A}.Release|Mixed Platforms.Build.0 = Release|Win32
{D9AF008C-EE25-49B3-96F6-E81B8A59D017}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D9AF008C-EE25-49B3-96F6-E81B8A59D017}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D9AF008C-EE25-49B3-96F6-E81B8A59D017}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {D9AF008C-EE25-49B3-96F6-E81B8A59D017}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{D9AF008C-EE25-49B3-96F6-E81B8A59D017}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D9AF008C-EE25-49B3-96F6-E81B8A59D017}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D9AF008C-EE25-49B3-96F6-E81B8A59D017}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {D9AF008C-EE25-49B3-96F6-E81B8A59D017}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{8C433ABF-AFE5-4A76-BEBC-74116EC3460E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8C433ABF-AFE5-4A76-BEBC-74116EC3460E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8C433ABF-AFE5-4A76-BEBC-74116EC3460E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {8C433ABF-AFE5-4A76-BEBC-74116EC3460E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{8C433ABF-AFE5-4A76-BEBC-74116EC3460E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8C433ABF-AFE5-4A76-BEBC-74116EC3460E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {8C433ABF-AFE5-4A76-BEBC-74116EC3460E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {8C433ABF-AFE5-4A76-BEBC-74116EC3460E}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {6D11A4EE-DB7F-4DDD-A3ED-46A7E9D331DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {6D11A4EE-DB7F-4DDD-A3ED-46A7E9D331DE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {6D11A4EE-DB7F-4DDD-A3ED-46A7E9D331DE}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {6D11A4EE-DB7F-4DDD-A3ED-46A7E9D331DE}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {6D11A4EE-DB7F-4DDD-A3ED-46A7E9D331DE}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {6D11A4EE-DB7F-4DDD-A3ED-46A7E9D331DE}.Release|Any CPU.Build.0 = Release|Any CPU
+ {6D11A4EE-DB7F-4DDD-A3ED-46A7E9D331DE}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {6D11A4EE-DB7F-4DDD-A3ED-46A7E9D331DE}.Release|Mixed Platforms.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
View
64 DICOMTests/DICOMTests.csproj
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{6D11A4EE-DB7F-4DDD-A3ED-46A7E9D331DE}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Dicom</RootNamespace>
+ <AssemblyName>DicomTests</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="nunit.framework">
+ <HintPath>..\packages\NUnit.2.6.2\lib\nunit.framework.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Runtime.Serialization" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="DicomTagTests.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="Helpers\Serialization.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="packages.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\DICOM\DICOM.csproj">
+ <Project>{D6E309B0-4837-459E-8C85-ABC268440D62}</Project>
+ <Name>DICOM</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
View
28 DICOMTests/DicomTagTests.cs
@@ -0,0 +1,28 @@
+// Copyright (c) 2012 Anders Gustafsson, Cureos AB.
+// Licensed under the Microsoft Public License (MS-PL).
+
+using Dicom.Helpers;
+using NUnit.Framework;
+
+namespace Dicom
+{
+ [TestFixture]
+ public class DicomTagTests
+ {
+ [Test]
+ public void Serialization_RegularTag_CanBeDeserialized()
+ {
+ var expected = DicomTag.BeamDose;
+ var actual = expected.GetSerializedDeserializedObject();
+ Assert.AreEqual(expected, actual);
+ }
+
+ [Test]
+ public void Serialization_PrivateCreatorTag_CanBeDeserialized()
+ {
+ var expected = new DicomTag(0x3005, 0x1013, "CUREOS");
+ var actual = expected.GetSerializedDeserializedObject();
+ Assert.AreEqual(expected, actual);
+ }
+ }
+}
View
32 DICOMTests/Helpers/Serialization.cs
@@ -0,0 +1,32 @@
+// Copyright (c) 2012 Anders Gustafsson, Cureos AB.
+// Licensed under the Microsoft Public License (MS-PL).
+
+using System.IO;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Xml;
+
+namespace Dicom.Helpers
+{
+ public static class Serialization
+ {
+ public static T GetSerializedDeserializedObject<T>(this T tag)
+ {
+ var _serializer = new DataContractSerializer(typeof(T));
+
+ T deserializedObject;
+ var builder = new StringBuilder();
+ using (var writer = XmlWriter.Create(builder))
+ {
+ _serializer.WriteObject(writer, tag);
+ writer.Close();
+
+ using (var stream = new MemoryStream(Encoding.Unicode.GetBytes(builder.ToString())))
+ {
+ deserializedObject = (T)_serializer.ReadObject(stream);
+ }
+ }
+ return deserializedObject;
+ }
+ }
+}
View
36 DICOMTests/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("DICOMTests")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Cureos AB")]
+[assembly: AssemblyProduct("DICOMTests")]
+[assembly: AssemblyCopyright("Copyright © Cureos AB 2012")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("7631ab22-611c-494d-861c-ec8111588281")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
View
4 DICOMTests/packages.config
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="NUnit" version="2.6.2" targetFramework="net40" />
+</packages>
View
3 packages/repositories.config
@@ -1,4 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<repositories>
+ <repository path="..\ConsoleTest\packages.config" />
+ <repository path="..\DICOM\packages.config" />
+ <repository path="..\DICOMTests\packages.config" />
<repository path="..\Examples\C-Store SCP\packages.config" />
</repositories>

0 comments on commit ba5bce1

Please sign in to comment.
Something went wrong with that request. Please try again.