Skip to content
This repository was archived by the owner on Jan 3, 2022. It is now read-only.

Commit 2f951a2

Browse files
committed
Added NUnit tests for automatic tests on the application library
1 parent 72ed07c commit 2f951a2

File tree

7 files changed

+203
-1
lines changed

7 files changed

+203
-1
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@
44
/src/_ReSharper.dshell.vs2010
55
/src/packages
66
/src/sampleapp/obj
7-
/src/sampleapp/bin
7+
/src/sampleapp/bin
8+
/src/dshell-nunit.vs2010/obj
9+
/src/dshell-nunit.vs2010/bin
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
3+
namespace Deveel.Console {
4+
public delegate void StringWriteEventHandler(object sender, StringWriteEventArgs args);
5+
6+
public sealed class StringWriteEventArgs : EventArgs {
7+
public readonly string s;
8+
9+
public StringWriteEventArgs(string s) {
10+
this.s = s;
11+
}
12+
13+
public string Value {
14+
get { return s; }
15+
}
16+
}
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using System.Text;
5+
6+
namespace Deveel.Console {
7+
class TestOutputDevice : OutputDevice {
8+
private readonly TextWriter outputSink;
9+
private readonly List<string> stringList;
10+
11+
public TestOutputDevice() {
12+
outputSink = new OutputSink(this);
13+
stringList = new List<string>();
14+
}
15+
16+
public event StringWriteEventHandler StringWritten;
17+
18+
public override Encoding Encoding {
19+
get { return Encoding.ASCII; }
20+
}
21+
22+
protected override TextWriter Output {
23+
get { return outputSink; }
24+
}
25+
26+
public IEnumerable<string> Strings {
27+
get { return stringList.AsReadOnly(); }
28+
}
29+
30+
protected void OnStringWritten(string s) {
31+
if (StringWritten != null)
32+
StringWritten(this, new StringWriteEventArgs(s));
33+
34+
stringList.Add(s);
35+
}
36+
37+
#region OutputSink
38+
39+
class OutputSink : TextWriter {
40+
private readonly TestOutputDevice outputDevice;
41+
42+
public OutputSink(TestOutputDevice outputDevice) {
43+
this.outputDevice = outputDevice;
44+
}
45+
46+
public override Encoding Encoding {
47+
get { return outputDevice.Encoding; }
48+
}
49+
50+
public override void Write(char[] buffer, int index, int count) {
51+
outputDevice.OnStringWritten(new string(buffer, index, count));
52+
}
53+
}
54+
55+
#endregion
56+
}
57+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// Le informazioni generali relative a un assembly sono controllate dal seguente
6+
// set di attributi. Per modificare le informazioni associate a un assembly
7+
// occorre quindi modificare i valori di questi attributi.
8+
[assembly: AssemblyTitle("dshell-nunit")]
9+
[assembly: AssemblyDescription("Deveel Shell Library NUnit Tests")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("Deveel")]
12+
[assembly: AssemblyProduct("dshell-nunit")]
13+
[assembly: AssemblyCopyright("Copyright © Deveel 2012")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili
18+
// ai componenti COM. Se è necessario accedere a un tipo in questo assembly da
19+
// COM, impostare su true l'attributo ComVisible per tale tipo.
20+
[assembly: ComVisible(false)]
21+
22+
// Se il progetto viene esposto a COM, il GUID che segue verrà utilizzato per creare l'ID della libreria dei tipi
23+
[assembly: Guid("3bba22e3-4f21-4bbc-8663-a292ecb9ae2d")]
24+
25+
// Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori:
26+
//
27+
// Numero di versione principale
28+
// Numero di versione secondario
29+
// Numero build
30+
// Revisione
31+
//
32+
// È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build
33+
// utilizzando l'asterisco (*) come descritto di seguito:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("0.6.7.*")]
36+
[assembly: AssemblyFileVersion("0.6.7.0")]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProductVersion>8.0.30703</ProductVersion>
7+
<SchemaVersion>2.0</SchemaVersion>
8+
<ProjectGuid>{443F911C-939E-4098-AAB0-8E452FA28E80}</ProjectGuid>
9+
<OutputType>Library</OutputType>
10+
<AppDesignerFolder>Properties</AppDesignerFolder>
11+
<RootNamespace>Deveel.Console</RootNamespace>
12+
<AssemblyName>dshell-nunit</AssemblyName>
13+
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
14+
<FileAlignment>512</FileAlignment>
15+
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17+
<DebugSymbols>true</DebugSymbols>
18+
<DebugType>full</DebugType>
19+
<Optimize>false</Optimize>
20+
<OutputPath>bin\Debug\</OutputPath>
21+
<DefineConstants>DEBUG;TRACE</DefineConstants>
22+
<ErrorReport>prompt</ErrorReport>
23+
<WarningLevel>4</WarningLevel>
24+
</PropertyGroup>
25+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26+
<DebugType>pdbonly</DebugType>
27+
<Optimize>true</Optimize>
28+
<OutputPath>bin\Release\</OutputPath>
29+
<DefineConstants>TRACE</DefineConstants>
30+
<ErrorReport>prompt</ErrorReport>
31+
<WarningLevel>4</WarningLevel>
32+
</PropertyGroup>
33+
<ItemGroup>
34+
<Reference Include="System" />
35+
</ItemGroup>
36+
<ItemGroup>
37+
<Compile Include="Deveel.Console\StringWriteEventArgs.cs" />
38+
<Compile Include="Deveel.Console\TestOutputDevice.cs" />
39+
<Compile Include="Properties\AssemblyInfo.cs" />
40+
</ItemGroup>
41+
<ItemGroup>
42+
<ProjectReference Include="..\dshell\dshell.vs2010.csproj">
43+
<Project>{5E849796-A39E-4AF8-A516-D2837C3CCE6F}</Project>
44+
<Name>dshell.vs2010</Name>
45+
</ProjectReference>
46+
</ItemGroup>
47+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
48+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
49+
Other similar extension points exist, see Microsoft.Common.targets.
50+
<Target Name="BeforeBuild">
51+
</Target>
52+
<Target Name="AfterBuild">
53+
</Target>
54+
-->
55+
</Project>

src/dshell.vs2010.sln

+12
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dshell.vs2010", "dshell\dsh
55
EndProject
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sampleapp", "sampleapp\sampleapp.csproj", "{EBC6095C-6575-4716-A937-4280B37ABCE6}"
77
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dshell-nunit.vs2010", "dshell-nunit.vs2010\dshell-nunit.vs2010.csproj", "{443F911C-939E-4098-AAB0-8E452FA28E80}"
9+
EndProject
810
Global
911
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1012
Debug|Any CPU = Debug|Any CPU
@@ -35,6 +37,16 @@ Global
3537
{EBC6095C-6575-4716-A937-4280B37ABCE6}.Release|Mixed Platforms.Build.0 = Release|x86
3638
{EBC6095C-6575-4716-A937-4280B37ABCE6}.Release|x86.ActiveCfg = Release|x86
3739
{EBC6095C-6575-4716-A937-4280B37ABCE6}.Release|x86.Build.0 = Release|x86
40+
{443F911C-939E-4098-AAB0-8E452FA28E80}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
41+
{443F911C-939E-4098-AAB0-8E452FA28E80}.Debug|Any CPU.Build.0 = Debug|Any CPU
42+
{443F911C-939E-4098-AAB0-8E452FA28E80}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
43+
{443F911C-939E-4098-AAB0-8E452FA28E80}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
44+
{443F911C-939E-4098-AAB0-8E452FA28E80}.Debug|x86.ActiveCfg = Debug|Any CPU
45+
{443F911C-939E-4098-AAB0-8E452FA28E80}.Release|Any CPU.ActiveCfg = Release|Any CPU
46+
{443F911C-939E-4098-AAB0-8E452FA28E80}.Release|Any CPU.Build.0 = Release|Any CPU
47+
{443F911C-939E-4098-AAB0-8E452FA28E80}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
48+
{443F911C-939E-4098-AAB0-8E452FA28E80}.Release|Mixed Platforms.Build.0 = Release|Any CPU
49+
{443F911C-939E-4098-AAB0-8E452FA28E80}.Release|x86.ActiveCfg = Release|Any CPU
3850
EndGlobalSection
3951
GlobalSection(SolutionProperties) = preSolution
4052
HideSolutionNode = FALSE

src/dshell/dshell.0.6.7-beta.nuspec

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0"?>
2+
<package xmlns="http://schemas.microsoft.com/packaging/2011/10/nuspec.xsd">
3+
<metadata>
4+
<version>0.6.7-beta</version>
5+
<authors>Antonello Provenzano</authors>
6+
<owners>Deveel</owners>
7+
<licenseUrl>http://www.apache.org/licenses/LICENSE-2.0.html</licenseUrl>
8+
<projectUrl>http://github.com/deveel/dshell</projectUrl>
9+
<dependencies>
10+
<dependency id="deveelrl" />
11+
<dependency id="deveel-cli" version="1.0.1" />
12+
</dependencies>
13+
<id>dshell</id>
14+
<title>Deveel Shell Application Library</title>
15+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
16+
<description>This library is used to easily develop .NET/Mono shell applications, providing command line parsing, execution context, and other functionalities to design interactive console applications.</description>
17+
<copyright>Copyright 2010-2012 Deveel</copyright>
18+
<tags>command-line console shell .NET Mono deveel application command</tags>
19+
</metadata>
20+
<files>
21+
<file src="bin\Release\dshell.dll" target="lib\net20\dshell.dll" />
22+
</files>
23+
</package>

0 commit comments

Comments
 (0)