Skip to content

Commit

Permalink
Add testing project and the required library (nunit)
Browse files Browse the repository at this point in the history
  • Loading branch information
jetcat committed Jan 25, 2009
1 parent ce715d9 commit 3499627
Show file tree
Hide file tree
Showing 5 changed files with 136 additions and 0 deletions.
Binary file added lib/nunit.framework.dll
Binary file not shown.
57 changes: 57 additions & 0 deletions src/ExcelLibrary.Test/ExcelLibrary.Test.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{4CA6D225-46CA-4B23-8C80-AA8E410960C5}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ExcelLibrary.Test</RootNamespace>
<AssemblyName>ExcelLibrary.Test</AssemblyName>
</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, Version=2.4.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="SimpleTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ExcelLibrary\ExcelLibrary.csproj">
<Project>{0716F257-72DD-41EF-8E79-54BA388E3AB1}</Project>
<Name>ExcelLibrary</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\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>
35 changes: 35 additions & 0 deletions src/ExcelLibrary.Test/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -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("ExcelLibrary.Test")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ExcelLibrary.Test")]
[assembly: AssemblyCopyright("Copyright © 2009")]
[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("03430e36-e278-4fea-8720-aa552287ecee")]

// 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")]
34 changes: 34 additions & 0 deletions src/ExcelLibrary.Test/SimpleTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System.IO;
using NUnit.Framework;
using QiHe.Office.Excel;

namespace ExcelLibrary.Test
{
[TestFixture]
public class SimpleTest
{
[Test]
public void SimpleReadWriteTest()
{
string tempFilePath = Path.GetTempFileName();
{
Workbook workbook = new Workbook();
Worksheet worksheet = new Worksheet("Test1");
worksheet.Cells[0, 1] = new Cell(100);
worksheet.Cells[2, 0] = new Cell("Test String");
workbook.Worksheets.Add(worksheet);
workbook.Save(tempFilePath);
}

{
Workbook workbook = Workbook.Open(tempFilePath);
Assert.AreEqual(1, workbook.Worksheets.Count);

Worksheet worksheet = workbook.Worksheets[0];
Assert.AreEqual("Test1", worksheet.Name);
Assert.AreEqual(100, worksheet.Cells[0, 1].Value);
Assert.AreEqual("Test String", worksheet.Cells[2, 0].Value);
}
}
}
}
10 changes: 10 additions & 0 deletions src/ExcelLibrary.sln
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExcelLibrary.WinForm", "Exc
Release.AspNetCompiler.Debug = "False"
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExcelLibrary.Test", "ExcelLibrary.Test\ExcelLibrary.Test.csproj", "{4CA6D225-46CA-4B23-8C80-AA8E410960C5}"
ProjectSection(WebsiteProperties) = preProject
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.Debug = "False"
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -27,6 +33,10 @@ Global
{116F6530-AE90-4E1A-8D03-2BD609DA6C7D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{116F6530-AE90-4E1A-8D03-2BD609DA6C7D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{116F6530-AE90-4E1A-8D03-2BD609DA6C7D}.Release|Any CPU.Build.0 = Release|Any CPU
{4CA6D225-46CA-4B23-8C80-AA8E410960C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4CA6D225-46CA-4B23-8C80-AA8E410960C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4CA6D225-46CA-4B23-8C80-AA8E410960C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4CA6D225-46CA-4B23-8C80-AA8E410960C5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down

0 comments on commit 3499627

Please sign in to comment.