Skip to content

Commit 30decf1

Browse files
committed
added coverage report
1 parent c3da311 commit 30decf1

File tree

6 files changed

+437
-12
lines changed

6 files changed

+437
-12
lines changed

Code/UnitTests/Epic.Query.Linq.UnitTests/Epic.Query.Linq.UnitTests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,5 +93,6 @@
9393
<Compile Include="Expressions\Normalization\EnumerableMethodsReducerQA.cs" />
9494
<Compile Include="Expressions\Normalization\QueryableMethodsReducerQA.cs" />
9595
<Compile Include="Expressions\Normalization\DefaultNormalizerQA.cs" />
96+
<Compile Include="MissingMethods.cs" />
9697
</ItemGroup>
9798
</Project>
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
//
2+
// MissingMethods.cs
3+
//
4+
// Author:
5+
// Giacomo Tesio <giacomo@tesio.it>
6+
//
7+
// Copyright (c) 2010-2012 Giacomo Tesio
8+
//
9+
// This file is part of Epic.NET.
10+
//
11+
// Epic.NET is free software: you can redistribute it and/or modify
12+
// it under the terms of the GNU Affero General Public License as published by
13+
// the Free Software Foundation, either version 3 of the License, or
14+
// (at your option) any later version.
15+
//
16+
// Epic.NET is distributed in the hope that it will be useful,
17+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
// GNU Affero General Public License for more details.
20+
//
21+
// You should have received a copy of the GNU Affero General Public License
22+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
23+
//
24+
using NUnit.Framework;
25+
using System;
26+
using System.Linq.Expressions;
27+
using System.Linq;
28+
29+
namespace Epic.Query.Linq
30+
{
31+
[TestFixture()]
32+
public class MissingMethods : RhinoMocksFixtureBase
33+
{
34+
[Test]
35+
public void QueryProvider_Execute_throwsNotImplementedException()
36+
{
37+
// arrange:
38+
IQueryProvider provider = new QueryProvider("Test");
39+
40+
// assert:
41+
Assert.Throws<NotImplementedException>(delegate {
42+
provider.Execute(Expression.Constant(1));
43+
});
44+
Assert.Throws<NotImplementedException>(delegate {
45+
provider.Execute<int>(Expression.Constant(1));
46+
});
47+
}
48+
49+
[Test]
50+
public void RepositoryBase_getItem_throwsNotImplementedException()
51+
{
52+
// arrange:
53+
string result = null;
54+
IQueryableRepository<string,int> repository = new Fakes.FakeRepository<string,int>("test");
55+
56+
// assert:
57+
Assert.Throws<NotImplementedException>(delegate {
58+
result = repository[1];
59+
});
60+
Assert.IsNull(result);
61+
}
62+
}
63+
}
64+

Code/nant.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
<foreach item="String" in="${projects}" delim="," property="project">
3131
<property name="project.name" value="${common.namespace + '.' + project + '.UnitTests'}"/>
3232
<property name="project.path" value="${path::combine('UnitTests', path::combine(project.name, project.name + '.csproj'))}"/>
33-
<property name="tests.to.run" value="${project.name + '.dll'}" if="${not property::exists('tests.to.run')}"/>
3433
<property name="tests.to.run" value="${tests.to.run +' '+project.name + '.dll'}" if="${property::exists('tests.to.run')}"/>
34+
<property name="tests.to.run" value="${project.name + '.dll'}" if="${not property::exists('tests.to.run')}"/>
3535
<echo message="Building ${project.name}." />
3636
<exec program="${msbuild.path}"
3737
commandline="${project.path} /t:${build.target} /p:Configuration=${build.configuration} /v:${build.verbosity}"

Tools/NantScripts/Properties.include

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,21 @@
1616
<property name="msbuild.path" value="${path::combine(framework::get-framework-directory(framework::get-target-framework()), msbuild.name)}" />
1717

1818
<property name="library.dir" value="${path::combine(repository.rootdirectory, '3rdParties')}" />
19-
<property name="nunit.path" value="${path::combine(path::combine(library.dir, 'NUnit'), 'nunit-console.exe')}" />
19+
<property name="nunit.path" value="${path::combine(path::combine(library.dir, 'NUnit'), 'nunit-console.exe')}" overwrite="false" />
2020
<property name="samples.dir" value="${path::combine(repository.rootdirectory, 'Challenges')}" />
21+
22+
<property name="MailLogger.failure.notify" value="true" if="${property::exists('MailLogger.mailhost')}" />
23+
<property name="MailLogger.success.notify" value="true" if="${property::exists('MailLogger.mailhost')}" />
24+
<property name="MailLogger.failure.subject" value="Epic.NET build failure" if="${property::exists('MailLogger.mailhost')}" />
25+
<property name="MailLogger.success.subject" value="Epic.NET build successful" if="${property::exists('MailLogger.mailhost')}" />
26+
<property name="MailLogger.failure.attachments" value="MailLogger.files" if="${property::exists('MailLogger.mailhost')}" />
27+
<property name="MailLogger.success.attachments" value="MailLogger.files" if="${property::exists('MailLogger.mailhost')}" />
28+
29+
30+
<fileset id="MailLogger.files">
31+
<include name="${path::combine(repository.testdirectory, '*.QA.xml')}" />
32+
<include name="${path::combine(repository.testdirectory, '*.Coverage.xml')}" />
33+
<include name="${path::combine(repository.testdirectory, '*.Coverage.html')}" />
34+
</fileset>
2135

2236
</project>

Tools/NantScripts/RunNUnit.include

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,43 @@
11
<?xml version="1.0" encoding="UTF-8" ?>
22
<project name="RunNUnit" default="run-tests" xmlns="http://nant.sf.net/schemas/nant.xsd">
33
<target name="run-nunit">
4+
<property name="coverage-file" value="${path::combine(repository.testdirectory, component.name + '.Coverage')}"/>
45
<property name="results-file" value="${path::combine(repository.testdirectory, component.name + '.QA')}"/>
56
<property name="working.dir" value="${working.dir}" overwrite="false"/>
6-
<if test="${not property::exists('build.number')}">
7+
<if test="${not property::exists('ncover.path')}">
78
<exec workingdir="${working.dir}"
89
program="${nunit.path}">
910
<arg line="${tests.to.run}" />
1011
<arg value="-nologo" />
1112
<arg value="-xml=${results-file}.xml" />
1213
</exec>
1314
</if>
14-
<if test="${property::exists('build.number')}">
15-
<nunit2>
16-
<formatter type="Xml" usefile="true" extension=".QA.xml" outputdir="${repository.testdirectory}" />
17-
<test>
18-
<assemblies>
19-
<include name="${path::combine(repository.testdirectory, '*.UnitTests.dll')}" />
20-
</assemblies>
21-
</test>
22-
</nunit2>
15+
16+
<if test="${property::exists('ncover.path')}">
17+
<property name="working.dir" value="${working.dir}" overwrite="false"/>
18+
<exec workingdir="${path::get-directory-name(ncover.path)}"
19+
program="${ncover.path}">
20+
<arg value="//reg" />
21+
<arg line="//w &quot;${working.dir}&quot;" />
22+
<arg line="//x &quot;${coverage-file}.xml&quot;" />
23+
<arg line="//a ${string::replace(string::replace(tests.to.run, '.UnitTests.dll', ';'), ' ', '')}" />
24+
<arg value="${nunit.path}"/>
25+
<arg line="${tests.to.run}" />
26+
<arg value="-nologo" />
27+
<arg value="-xml=${results-file}.xml" />
28+
</exec>
2329
</if>
30+
31+
<style if="${file::exists(coverage-file + '.xml')}"
32+
style="${path::combine(nant.include.dir, 'coverage.xsl')}"
33+
in="${coverage-file}.xml"
34+
out="${coverage-file}.html"/>
35+
<xmlpeek if="${file::exists(coverage-file + '.xml')}"
36+
file="${coverage-file}.xml"
37+
xpath="//method[seqpnt[@visitcount='0']]/@name"
38+
nodeindex="0"
39+
property="uncovered-method"/>
40+
<fail if="${property::exists('uncovered-method')}"
41+
message="Incomplete code coverage in ${component.name}. See ${path::get-file-name(coverage-file)}.html for details."/>
2442
</target>
2543
</project>

0 commit comments

Comments
 (0)