-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from T145/master
Project cleanup and refinement
- Loading branch information
Showing
57 changed files
with
35,752 additions
and
37,003 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CHANGELOG | ||
|
||
Version 0.2 | ||
- Added number string parser | ||
- Converted tests to run against NUnit | ||
|
||
Version 0.1 | ||
- Initial project |
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,264 @@ | ||
using System; | ||
using Cubico; | ||
using NUnit.Framework; | ||
|
||
namespace Cubico.Tests | ||
{ | ||
[TestFixture] | ||
public class ConversionResultTest | ||
{ | ||
TestContext testContextInstance; | ||
|
||
// Gets or sets the test context which provides information about and functionality for the current test run. | ||
public TestContext TestContext { | ||
get { return testContextInstance; } | ||
set { testContextInstance = value; } | ||
} | ||
|
||
#region "ConversionResult.ConversionResult()" | ||
|
||
[Test] | ||
public void ConversionResultConstructorTest () | ||
{ | ||
ConversionResult res = new ConversionResult (); | ||
|
||
Assert.IsNotNull (res); | ||
Assert.AreEqual (0, res.Value); | ||
Assert.AreEqual (Result.NoError, res.Result); | ||
Assert.AreEqual (null, res.Symbol); | ||
} | ||
|
||
#endregion | ||
#region "ConversionResult.ConversionResult(Double)" | ||
|
||
[Test] | ||
public void ConversionResultConstructorDoubleTest () | ||
{ | ||
ConversionResult res = new ConversionResult (10.5); | ||
|
||
Assert.IsNotNull (res); | ||
Assert.AreEqual (10.5, res.Value); | ||
Assert.AreEqual (Result.NoError, res.Result); | ||
Assert.AreEqual (null, res.Symbol); | ||
} | ||
|
||
[Test] | ||
public void ConversionResultConstructorDoubleZeroTest () | ||
{ | ||
ConversionResult res = new ConversionResult ((double)0); | ||
|
||
Assert.IsNotNull (res); | ||
Assert.AreEqual (0, res.Value); | ||
Assert.AreEqual (Result.NoError, res.Result); | ||
Assert.AreEqual (null, res.Symbol); | ||
} | ||
|
||
#endregion | ||
#region "ConversionResult.ConversionResult(Double, String)" | ||
|
||
[Test] | ||
public void ConversionResultConstructorDoubleStringTest () | ||
{ | ||
ConversionResult res = new ConversionResult (10.5, "lb"); | ||
|
||
Assert.IsNotNull (res); | ||
Assert.AreEqual (10.5, res.Value); | ||
Assert.AreEqual (Result.NoError, res.Result); | ||
Assert.AreEqual ("lb", res.Symbol); | ||
} | ||
|
||
[Test] | ||
public void ConversionResultConstructorDoubleStringNullTest () | ||
{ | ||
ConversionResult res = new ConversionResult (0, Convert.ToString (null)); | ||
|
||
Assert.IsNotNull (res); | ||
Assert.AreEqual (0, res.Value); | ||
Assert.AreEqual (Result.NoError, res.Result); | ||
Assert.AreEqual (null, res.Symbol); | ||
} | ||
|
||
[Test] | ||
public void ConversionResultConstructorDoubleStringNullTest2 () | ||
{ | ||
ConversionResult res = new ConversionResult (10.5, Convert.ToString (null)); | ||
|
||
Assert.IsNotNull (res); | ||
Assert.AreEqual (10.5, res.Value); | ||
Assert.AreEqual (Result.NoError, res.Result); | ||
Assert.AreEqual (null, res.Symbol); | ||
} | ||
|
||
[Test] | ||
public void ConversionResultConstructorDoubleStringZeroTest3 () | ||
{ | ||
ConversionResult res = new ConversionResult (0, "lb"); | ||
|
||
Assert.IsNotNull (res); | ||
Assert.AreEqual (0, res.Value); | ||
Assert.AreEqual (Result.NoError, res.Result); | ||
Assert.AreEqual ("lb", res.Symbol); | ||
} | ||
|
||
#endregion | ||
#region "ConversionResult.ConversionResult(Double, Result)" | ||
|
||
[Test] | ||
public void ConversionResultConstructorDoubleResultTest () | ||
{ | ||
ConversionResult res = new ConversionResult (10.5, Result.GenericError); | ||
|
||
Assert.IsNotNull (res); | ||
Assert.AreEqual (10.5, res.Value); | ||
Assert.AreEqual (Result.GenericError, res.Result); | ||
Assert.AreEqual (null, res.Symbol); | ||
} | ||
|
||
[Test] | ||
public void ConversionResultConstructorDoubleResultNullTest () | ||
{ | ||
ConversionResult res = new ConversionResult (0, (Result)0); | ||
|
||
Assert.IsNotNull (res); | ||
Assert.AreEqual (0, res.Value); | ||
Assert.AreEqual (Result.NoError, res.Result); | ||
Assert.AreEqual (null, res.Symbol); | ||
} | ||
|
||
[Test] | ||
public void ConversionResultConstructorDoubleResultNullTest2 () | ||
{ | ||
ConversionResult res = new ConversionResult (10.5, (Result)0); | ||
|
||
Assert.IsNotNull (res); | ||
Assert.AreEqual (10.5, res.Value); | ||
Assert.AreEqual (Result.NoError, res.Result); | ||
Assert.AreEqual (null, res.Symbol); | ||
} | ||
|
||
[Test] | ||
public void ConversionResultConstructorDoubleResultNullTest3 () | ||
{ | ||
ConversionResult res = new ConversionResult (0, Result.GenericError); | ||
|
||
Assert.IsNotNull (res); | ||
Assert.AreEqual (0, res.Value); | ||
Assert.AreEqual (Result.GenericError, res.Result); | ||
Assert.AreEqual (null, res.Symbol); | ||
} | ||
|
||
#endregion | ||
#region "ConversionResult.ConversionResult(Result)" | ||
|
||
[Test] | ||
public void ConversionResultConstructorResultTest () | ||
{ | ||
ConversionResult res = new ConversionResult (Result.GenericError); | ||
|
||
Assert.IsNotNull (res); | ||
Assert.AreEqual (0, res.Value); | ||
Assert.AreEqual (Result.GenericError, res.Result); | ||
Assert.AreEqual (null, res.Symbol); | ||
} | ||
|
||
[Test] | ||
public void ConversionResultConstructorResultNullTest () | ||
{ | ||
ConversionResult res = new ConversionResult (0.0); | ||
|
||
Assert.IsNotNull (res); | ||
Assert.AreEqual (0, res.Value); | ||
Assert.AreEqual (Result.NoError, res.Result); | ||
Assert.AreEqual (null, res.Symbol); | ||
} | ||
|
||
#endregion | ||
#region "ConversionResult.Result" | ||
|
||
[Test] | ||
public void ConversionResultResultTest () | ||
{ | ||
ConversionResult res = new ConversionResult (Result.GenericError); | ||
|
||
Assert.IsNotNull (res); | ||
Assert.AreEqual (Result.GenericError, res.Result); | ||
|
||
res.Result = Result.UnitNotFound; | ||
|
||
Assert.AreEqual (Result.UnitNotFound, res.Result); | ||
} | ||
|
||
[Test] | ||
public void ConversionResultResultNullTest () | ||
{ | ||
ConversionResult res = new ConversionResult (Result.GenericError); | ||
|
||
Assert.IsNotNull (res); | ||
Assert.AreEqual (Result.GenericError, res.Result); | ||
|
||
res.Result = Result.NoError; | ||
|
||
Assert.AreEqual (Result.NoError, res.Result); | ||
} | ||
|
||
#endregion | ||
#region "ConversionResult.Value" | ||
|
||
[Test] | ||
public void ConversionResultValueTest () | ||
{ | ||
ConversionResult res = new ConversionResult (12.1); | ||
|
||
Assert.IsNotNull (res); | ||
Assert.AreEqual (12.1, res.Value); | ||
|
||
res.Value = 0.33; | ||
|
||
Assert.AreEqual (0.33, res.Value); | ||
} | ||
|
||
[Test] | ||
public void ConversionResultValueNullTest () | ||
{ | ||
ConversionResult res = new ConversionResult (12.1); | ||
|
||
Assert.IsNotNull (res); | ||
Assert.AreEqual (12.1, res.Value); | ||
|
||
res.Value = 0.0; | ||
|
||
Assert.AreEqual (0, res.Value); | ||
} | ||
|
||
#endregion | ||
#region "ConversionResult.Symbol" | ||
|
||
[Test] | ||
public void ConversionResultSymbolTest () | ||
{ | ||
ConversionResult res = new ConversionResult (12.1, "ft"); | ||
|
||
Assert.IsNotNull (res); | ||
Assert.AreEqual ("ft", res.Symbol); | ||
|
||
res.Symbol = "C"; | ||
|
||
Assert.AreEqual ("C", res.Symbol); | ||
} | ||
|
||
[Test] | ||
public void ConversionResultSymbolNullTest () | ||
{ | ||
ConversionResult res = new ConversionResult (12.1, "ft"); | ||
|
||
Assert.IsNotNull (res); | ||
Assert.AreEqual ("ft", res.Symbol); | ||
|
||
res.Symbol = null; | ||
|
||
Assert.AreEqual (null, res.Symbol); | ||
} | ||
|
||
#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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProductVersion>12.0.0</ProductVersion> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
<ProjectGuid>{8D4882D3-8D97-4D82-BE0E-AAC8A1D8B487}</ProjectGuid> | ||
<OutputType>Exe</OutputType> | ||
<RootNamespace>Cubico.Tests</RootNamespace> | ||
<AssemblyName>Cubico.Tests</AssemblyName> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug</OutputPath> | ||
<DefineConstants>DEBUG;</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<ConsolePause>false</ConsolePause> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release</OutputPath> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<ConsolePause>false</ConsolePause> | ||
</PropertyGroup> | ||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> | ||
<ItemGroup> | ||
<Compile Include="ConversionResultTest.cs" /> | ||
<Compile Include="MeasurementTests.cs" /> | ||
<Compile Include="ModifierTest.cs" /> | ||
<Compile Include="SymbolTest.cs" /> | ||
<Compile Include="UnitConverterTest.cs" /> | ||
<Compile Include="UnitConverterTest2.cs" /> | ||
<Compile Include="UnitConverterTest3.cs" /> | ||
<Compile Include="UnitConverterTest4.cs" /> | ||
<Compile Include="UnitProviderTest.cs" /> | ||
<Compile Include="UnitTest.cs" /> | ||
<Compile Include="UnitTestCategory.cs" /> | ||
<Compile Include="UnitTypeTest.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Cubico\Cubico.csproj"> | ||
<Project>{5C21F8E4-02C4-4614-97C7-1899F4E6E634}</Project> | ||
<Name>Cubico</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="nunit.framework, Version=2.6.0.12051, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77"> | ||
<Private>False</Private> | ||
</Reference> | ||
</ItemGroup> | ||
</Project> |
Oops, something went wrong.