From: <bor...@us...> - 2010-10-20 08:18:00
|
Revision: 225 http://axiomcontrib.svn.sourceforge.net/axiomcontrib/?rev=225&view=rev Author: borrillis Date: 2010-10-20 08:17:41 +0000 (Wed, 20 Oct 2010) Log Message: ----------- Added unit tests, requires mbUnit Modified Paths: -------------- OpenAsset/trunk/src/OpenAsset2010.sln Added Paths: ----------- OpenAsset/trunk/src/OpenAsset.Import.Tests/ OpenAsset/trunk/src/OpenAsset.Import.Tests/AssetTestFixture.cs OpenAsset/trunk/src/OpenAsset.Import.Tests/ColladaTestFixture.cs OpenAsset/trunk/src/OpenAsset.Import.Tests/OpenAsset.Import.Collada.Tests.csproj OpenAsset/trunk/src/OpenAsset.Import.Tests/Properties/ OpenAsset/trunk/src/OpenAsset.Import.Tests/Properties/AssemblyInfo.cs Added: OpenAsset/trunk/src/OpenAsset.Import.Tests/AssetTestFixture.cs =================================================================== --- OpenAsset/trunk/src/OpenAsset.Import.Tests/AssetTestFixture.cs (rev 0) +++ OpenAsset/trunk/src/OpenAsset.Import.Tests/AssetTestFixture.cs 2010-10-20 08:17:41 UTC (rev 225) @@ -0,0 +1,124 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Xml.Serialization; + +using Gallio.Framework; +using MbUnit.Framework; +using MbUnit.Framework.ContractVerifiers; + +namespace OpenAsset.Import.Collada.Tests +{ + [TestFixture] + public class AssetTestFixture + { + #region Helpers + private static global::Collada Deserialize( string collada ) + { + byte[] bytes = ( new System.Text.UTF8Encoding() ).GetBytes( collada ); + + var stream = new MemoryStream( bytes ); + + var serializer = new XmlSerializer( typeof( global::Collada ) ); + // Declare an object variable of the type to be deserialized. + global::Collada i; + + // Call the Deserialize method to restore the object's state. + i = (global::Collada)serializer.Deserialize( stream ); + return i; + } + #endregion Helpers + + [Test] + public void contributorElement_Test() + { + string collada = "<?xml version='1.0'?><COLLADA xmlns='http://www.collada.org/2005/11/COLLADASchema' version='1.4.1'><asset><contributor></contributor></asset></COLLADA>"; + global::Collada i = Deserialize( collada ); + + Assert.IsNotNull( i.asset ); + Assert.IsNotNull( i.asset.contributor ); + } + + [Test] + public void createdElement_Test() + { + string collada = "<?xml version='1.0'?><COLLADA xmlns='http://www.collada.org/2005/11/COLLADASchema' version='1.4.1'><asset><created>2009-01-18T04:21:00Z</created></asset></COLLADA>"; + global::Collada i = Deserialize( collada ); + + Assert.IsNotNull( i.asset ); + Assert.IsNotNull( i.asset.created ); + } + + [Test] + public void keywordsElement_Test() + { + string collada = "<?xml version='1.0'?><COLLADA xmlns='http://www.collada.org/2005/11/COLLADASchema' version='1.4.1'><asset><keywords></keywords></asset></COLLADA>"; + global::Collada i = Deserialize( collada ); + + Assert.IsNotNull( i.asset ); + Assert.IsNotNull( i.asset.keywords ); + } + + [Test] + public void modifiedElement_Test() + { + string collada = "<?xml version='1.0'?><COLLADA xmlns='http://www.collada.org/2005/11/COLLADASchema' version='1.4.1'><asset><modified>2009-01-18T04:21:00Z</modified></asset></COLLADA>"; + global::Collada i = Deserialize( collada ); + + Assert.IsNotNull( i.asset ); + Assert.IsNotNull( i.asset.modified ); + } + + [Test] + public void revisionElement_Test() + { + string collada = "<?xml version='1.0'?><COLLADA xmlns='http://www.collada.org/2005/11/COLLADASchema' version='1.4.1'><asset><revision></revision></asset></COLLADA>"; + global::Collada i = Deserialize( collada ); + + Assert.IsNotNull( i.asset ); + Assert.IsNotNull( i.asset.revision ); + } + + [Test] + public void subjectElement_Test() + { + string collada = "<?xml version='1.0'?><COLLADA xmlns='http://www.collada.org/2005/11/COLLADASchema' version='1.4.1'><asset><subject></subject></asset></COLLADA>"; + global::Collada i = Deserialize( collada ); + + Assert.IsNotNull( i.asset ); + Assert.IsNotNull( i.asset.subject ); + } + + [Test] + public void titleElement_Test() + { + string collada = "<?xml version='1.0'?><COLLADA xmlns='http://www.collada.org/2005/11/COLLADASchema' version='1.4.1'><asset><title></title></asset></COLLADA>"; + global::Collada i = Deserialize( collada ); + + Assert.IsNotNull( i.asset ); + Assert.IsNotNull( i.asset.title ); + } + + [Test] + public void unitElement_Test() + { + string collada = "<?xml version='1.0'?><COLLADA xmlns='http://www.collada.org/2005/11/COLLADASchema' version='1.4.1'><asset><unit></unit></asset></COLLADA>"; + global::Collada i = Deserialize( collada ); + + Assert.IsNotNull( i.asset ); + Assert.IsNotNull( i.asset.unit ); + } + + [Test] + public void up_axisElement_Test() + { + string collada = "<?xml version='1.0'?><COLLADA xmlns='http://www.collada.org/2005/11/COLLADASchema' version='1.4.1'><asset><up_axis>Y_UP</up_axis></asset></COLLADA>"; + global::Collada i = Deserialize( collada ); + + Assert.IsNotNull( i.asset ); + Assert.IsNotNull( i.asset.up_axis ); + } + + } +} Property changes on: OpenAsset/trunk/src/OpenAsset.Import.Tests/AssetTestFixture.cs ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: OpenAsset/trunk/src/OpenAsset.Import.Tests/ColladaTestFixture.cs =================================================================== --- OpenAsset/trunk/src/OpenAsset.Import.Tests/ColladaTestFixture.cs (rev 0) +++ OpenAsset/trunk/src/OpenAsset.Import.Tests/ColladaTestFixture.cs 2010-10-20 08:17:41 UTC (rev 225) @@ -0,0 +1,77 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Xml.Serialization; + +using Gallio.Framework; +using MbUnit.Framework; +using MbUnit.Framework.ContractVerifiers; + +namespace OpenAsset.Import.Collada.Tests +{ + [TestFixture] + public class ColladaTestFixture + { + #region Helpers + private static global::Collada Deserialize( string collada ) + { + byte[] bytes = ( new System.Text.UTF8Encoding() ).GetBytes( collada ); + + var stream = new MemoryStream( bytes ); + + var serializer = new XmlSerializer( typeof( global::Collada ) ); + // Declare an object variable of the type to be deserialized. + global::Collada i; + + // Call the Deserialize method to restore the object's state. + i = (global::Collada)serializer.Deserialize( stream ); + return i; + } + #endregion Helpers + + [Test] + [ExpectedArgumentNullException()] + public void versionRequired_Test() + { + string collada = "<?xml version='1.0'?><COLLADA xmlns='http://www.collada.org/2005/11/COLLADASchema'></COLLADA>"; + global::Collada i = Deserialize( collada ); + + Assert.IsNotNull( i ); + } + + [Test] + public void versionAttribute_Test() + { + string collada = "<?xml version='1.0'?><COLLADA xmlns='http://www.collada.org/2005/11/COLLADASchema' version='1.4.1'></COLLADA>"; + global::Collada i = Deserialize( collada ); + + Assert.IsNotNull( i ); + Assert.AreEqual( "1.4.1", i.version ); + } + + [Test] + public void assetElement_Required_Test() + { + string collada = "<?xml version='1.0'?><COLLADA xmlns='http://www.collada.org/2005/11/COLLADASchema' version='1.4.1'></COLLADA>"; + global::Collada i = Deserialize( collada ); + + Assert.IsNotNull( i ); + Assert.AreEqual( "1.4.1", i.version ); + Assert.IsNotNull( i.asset ); + } + + [Test] + public void assetElement_Test() + { + string collada = "<?xml version='1.0'?><COLLADA xmlns='http://www.collada.org/2005/11/COLLADASchema' version='1.4.1'><asset></asset></COLLADA>"; + global::Collada i = Deserialize( collada ); + + Assert.IsNotNull( i ); + Assert.AreEqual( "1.4.1", i.version ); + Assert.IsNotNull( i.asset ); + } + + + } +} Property changes on: OpenAsset/trunk/src/OpenAsset.Import.Tests/ColladaTestFixture.cs ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: OpenAsset/trunk/src/OpenAsset.Import.Tests/OpenAsset.Import.Collada.Tests.csproj =================================================================== --- OpenAsset/trunk/src/OpenAsset.Import.Tests/OpenAsset.Import.Collada.Tests.csproj (rev 0) +++ OpenAsset/trunk/src/OpenAsset.Import.Tests/OpenAsset.Import.Collada.Tests.csproj 2010-10-20 08:17:41 UTC (rev 225) @@ -0,0 +1,79 @@ +<?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>9.0.21022</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{BADFE3D0-E593-4E6E-843F-CAED1690FC74}</ProjectGuid> + <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>OpenAsset.Import.Tests</RootNamespace> + <AssemblyName>OpenAsset.Import.Tests</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="Axiom"> + <HintPath>..\..\lib\Axiom.dll</HintPath> + </Reference> + <Reference Include="Gallio" /> + <Reference Include="MbUnit" /> + <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" /> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + <Reference Include="Gallio35" /> + <Reference Include="MbUnit35" /> + <Reference Include="System.Core"> + <RequiredTargetFramework>4.0</RequiredTargetFramework> + </Reference> + <Reference Include="System.Xml.Linq"> + <RequiredTargetFramework>4.0</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data.DataSetExtensions"> + <RequiredTargetFramework>4.0</RequiredTargetFramework> + </Reference> + </ItemGroup> + <ItemGroup> + <Compile Include="AssetTestFixture.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="ColladaTestFixture.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\OpenAsset.Import.Collada\OpenAsset.Import.Collada.csproj"> + <Project>{D4B24520-EEFE-4780-872D-E64B6AA2ABBE}</Project> + <Name>OpenAsset.Import.Collada</Name> + </ProjectReference> + <ProjectReference Include="..\OpenAsset.Import\OpenAsset.Import.csproj"> + <Project>{A9E148C0-69E0-4300-8AA5-DA2934A7B7C6}</Project> + <Name>OpenAsset.Import</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> \ No newline at end of file Property changes on: OpenAsset/trunk/src/OpenAsset.Import.Tests/OpenAsset.Import.Collada.Tests.csproj ___________________________________________________________________ Added: svn:eol-style + native Added: OpenAsset/trunk/src/OpenAsset.Import.Tests/Properties/AssemblyInfo.cs =================================================================== --- OpenAsset/trunk/src/OpenAsset.Import.Tests/Properties/AssemblyInfo.cs (rev 0) +++ OpenAsset/trunk/src/OpenAsset.Import.Tests/Properties/AssemblyInfo.cs 2010-10-20 08:17:41 UTC (rev 225) @@ -0,0 +1,35 @@ +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( "OpenAsset.Import.Tests" )] +[assembly: AssemblyDescription( "" )] +[assembly: AssemblyConfiguration( "" )] +[assembly: AssemblyCompany( "Microsoft" )] +[assembly: AssemblyProduct( "OpenAsset.Import.Tests" )] +[assembly: AssemblyCopyright( "Copyright © Microsoft 2010" )] +[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( "04bca801-9670-4c00-8212-5eb92d0bd72c" )] + +// 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 Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion( "1.0.0.0" )] +[assembly: AssemblyFileVersion( "1.0.0.0" )] Property changes on: OpenAsset/trunk/src/OpenAsset.Import.Tests/Properties/AssemblyInfo.cs ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Modified: OpenAsset/trunk/src/OpenAsset2010.sln =================================================================== --- OpenAsset/trunk/src/OpenAsset2010.sln 2010-10-20 03:37:18 UTC (rev 224) +++ OpenAsset/trunk/src/OpenAsset2010.sln 2010-10-20 08:17:41 UTC (rev 225) @@ -7,6 +7,8 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenAsset.Import.DotScene", "OpenAsset.Import.DotScene\OpenAsset.Import.DotScene.csproj", "{908D43FC-58F9-45A4-9804-36E561693BA1}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenAsset.Import.Collada.Tests", "OpenAsset.Import.Tests\OpenAsset.Import.Collada.Tests.csproj", "{BADFE3D0-E593-4E6E-843F-CAED1690FC74}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -47,6 +49,16 @@ {908D43FC-58F9-45A4-9804-36E561693BA1}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {908D43FC-58F9-45A4-9804-36E561693BA1}.Release|Mixed Platforms.Build.0 = Release|Any CPU {908D43FC-58F9-45A4-9804-36E561693BA1}.Release|x86.ActiveCfg = Release|Any CPU + {BADFE3D0-E593-4E6E-843F-CAED1690FC74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BADFE3D0-E593-4E6E-843F-CAED1690FC74}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BADFE3D0-E593-4E6E-843F-CAED1690FC74}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {BADFE3D0-E593-4E6E-843F-CAED1690FC74}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {BADFE3D0-E593-4E6E-843F-CAED1690FC74}.Debug|x86.ActiveCfg = Debug|Any CPU + {BADFE3D0-E593-4E6E-843F-CAED1690FC74}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BADFE3D0-E593-4E6E-843F-CAED1690FC74}.Release|Any CPU.Build.0 = Release|Any CPU + {BADFE3D0-E593-4E6E-843F-CAED1690FC74}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {BADFE3D0-E593-4E6E-843F-CAED1690FC74}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {BADFE3D0-E593-4E6E-843F-CAED1690FC74}.Release|x86.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |