Merge lp:~john-park-west/concordion-net/update1 into lp:concordion-net

Proposed by John Park West
Status: Merged
Merged at revision: 77
Proposed branch: lp:~john-park-west/concordion-net/update1
Merge into: lp:concordion-net
Diff against target: 99 lines (+18/-13)
3 files modified
Gallio.ConcordionAdapter/Model/ConcordionTest.cs (+4/-4)
Gallio.ConcordionAdapter/Model/ConcordionTestController.cs (+3/-1)
Gallio.ConcordionAdapter/Model/ConcordionTestExplorer.cs (+11/-8)
To merge this branch: bzr merge lp:~john-park-west/concordion-net/update1
Reviewer Review Type Date Requested Status
jeffreycameron@gmail.com Pending
Review via email: mp+35639@code.launchpad.net

Description of the change

(1) Constructor call for the fixtures moved to ConcordionTestController (from ConcordionTestExplorer). Will avoid unwanted constructor calls when browsing the list of tests in tools like Icarus.
(2) ConcordionTestController to accept fixtures without "Test" at the end of the name.

To post a comment you must log in.
Revision history for this message
John Park West (john-park-west) wrote :

correction for my description..
(2) ConcordionTestExplorer to accept fixtures without "Test" at the end of the name.

Revision history for this message
jeffreycameron@gmail.com (jeffreycameron) wrote :

> correction for my description..
> (2) ConcordionTestExplorer to accept fixtures without "Test" at the end of the
> name.

Thanks muchly, incorporated the changes and pushed them up into the main branch. I'm a little sleepy tonight so I'll build and push these out tomorrow

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Gallio.ConcordionAdapter/Model/ConcordionTest.cs'
2--- Gallio.ConcordionAdapter/Model/ConcordionTest.cs 2010-09-12 12:44:48 +0000
3+++ Gallio.ConcordionAdapter/Model/ConcordionTest.cs 2010-09-16 09:38:07 +0000
4@@ -42,7 +42,7 @@
5 /// Gets or sets the fixture.
6 /// </summary>
7 /// <value>The fixture.</value>
8- public object Fixture
9+ public Type FixtureType
10 {
11 get;
12 private set;
13@@ -79,9 +79,9 @@
14 /// <param name="codeElement">The code element.</param>
15 /// <param name="typeInfo">The type info.</param>
16 /// <param name="resource">The resource.</param>
17- /// <param name="fixture">The fixture.</param>
18+ /// <param name="fixtureType">The fixture type.</param>
19
20- public ConcordionTest(string name, ICodeElementInfo codeElement, ConcordionTypeInfoAdapter typeInfo, Resource resource, object fixture)
21+ public ConcordionTest(string name, ICodeElementInfo codeElement, ConcordionTypeInfoAdapter typeInfo, Resource resource, Type fixtureType)
22 : base(name, codeElement)
23 {
24 if (typeInfo == null)
25@@ -89,7 +89,7 @@
26
27 this.TypeInfo = typeInfo;
28 this.Resource = resource;
29- this.Fixture = fixture;
30+ this.FixtureType = fixtureType;
31 }
32
33 #endregion
34
35=== modified file 'Gallio.ConcordionAdapter/Model/ConcordionTestController.cs'
36--- Gallio.ConcordionAdapter/Model/ConcordionTestController.cs 2010-09-12 12:44:48 +0000
37+++ Gallio.ConcordionAdapter/Model/ConcordionTestController.cs 2010-09-16 09:38:07 +0000
38@@ -75,7 +75,9 @@
39 .WithSpecificationListener(new GallioResultRenderer())
40 .Build();
41
42- var summary = concordion.Process(concordionTest.Resource, concordionTest.Fixture);
43+ ConstructorInfo constructor = concordionTest.FixtureType.GetConstructor(Type.EmptyTypes);
44+ var fixture=constructor.Invoke(new object[]{});
45+ var summary = concordion.Process(concordionTest.Resource, fixture);
46 bool passed = !(summary.HasFailures || summary.HasExceptions);
47 testContext.AddAssertCount((int)summary.SuccessCount + (int)summary.FailureCount);
48 return testContext.FinishStep(passed ? TestOutcome.Passed : TestOutcome.Failed, null);
49
50=== modified file 'Gallio.ConcordionAdapter/Model/ConcordionTestExplorer.cs'
51--- Gallio.ConcordionAdapter/Model/ConcordionTestExplorer.cs 2010-09-12 12:44:48 +0000
52+++ Gallio.ConcordionAdapter/Model/ConcordionTestExplorer.cs 2010-09-16 09:38:07 +0000
53@@ -168,11 +168,11 @@
54
55 private ConcordionTest CreateTypeTest(ConcordionTypeInfoAdapter typeInfo)
56 {
57- var fixture = CreateFixture(typeInfo.Target);
58- var resource = CreateResource(ExtrapolateResourcePath(fixture.GetType()));
59+ var fixtureType = CreateFixtureType(typeInfo.Target);
60+ var resource = CreateResource(ExtrapolateResourcePath(fixtureType));
61
62- var typeTest = new ConcordionTest(typeInfo.Target.Name, typeInfo.Target, typeInfo, resource, fixture);
63- typeTest.Source = new EmbeddedResourceSource(fixture.GetType().Assembly);
64+ var typeTest = new ConcordionTest(typeInfo.Target.Name, typeInfo.Target, typeInfo, resource, fixtureType);
65+ typeTest.Source = new EmbeddedResourceSource(fixtureType.Assembly);
66 typeTest.Target = new FileTarget(_baseOutputDirectory.FullName);
67 typeTest.Kind = TestKinds.Fixture;
68 typeTest.IsTestCase = true;
69@@ -185,7 +185,7 @@
70 return typeTest;
71 }
72
73- private object CreateFixture(ITypeInfo type)
74+ private Type CreateFixtureType(ITypeInfo type)
75 {
76 var resolvedType = type.Resolve(false);
77 if (resolvedType.IsClass)
78@@ -194,7 +194,7 @@
79
80 if (constructor != null)
81 {
82- return constructor.Invoke(new Object[] { });
83+ return resolvedType;
84 }
85 }
86
87@@ -205,8 +205,11 @@
88 {
89 var typeNamespace = type.Namespace;
90 typeNamespace = typeNamespace.Replace(".", "\\");
91- var fileName = type.Name.Remove(type.Name.Length - 4);
92-
93+ var fileName = type.Name;
94+ if (fileName.EndsWith("Test"))
95+ {
96+ fileName = fileName.Remove(fileName.Length - 4);
97+ }
98 return typeNamespace + "\\" + fileName + ".html";
99 }
100

Subscribers

People subscribed via source and target branches