-
Notifications
You must be signed in to change notification settings - Fork 747
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote branch 'origin/Silverlight'
Conflicts: Generator/Configuration/GeneratorConfiguration.cs Generator/TechTalk.SpecFlow.Generator.csproj Runtime/Configuration/RuntimeConfiguration.cs
- Loading branch information
Showing
46 changed files
with
1,410 additions
and
187 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 |
---|---|---|
|
@@ -11,4 +11,5 @@ obj/ | |
_ReSharper*/ | ||
[Tt]est[Rr]esult* | ||
*.resharper | ||
*.cache | ||
*.cache | ||
*.gpState |
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
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
124 changes: 124 additions & 0 deletions
124
Generator/UnitTestProvider/MsTestSilverlightGeneratorProvider.cs
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,124 @@ | ||
using System.CodeDom; | ||
using System.Collections.Generic; | ||
|
||
namespace TechTalk.SpecFlow.Generator.UnitTestProvider | ||
{ | ||
// TODO: it's an ugly copy-paste of MsTestGeneratorProvider - we should consider refactoring the generator creation to support custom factories. | ||
public class MsTestSilverlightGeneratorProvider : IUnitTestGeneratorProvider | ||
{ | ||
private const string TESTFIXTURE_ATTR = "Microsoft.VisualStudio.TestTools.UnitTesting.TestClassAttribute"; | ||
private const string TEST_ATTR = "Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute"; | ||
private const string PROPERTY_ATTR = "Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute"; | ||
private const string TESTFIXTURESETUP_ATTR = "Microsoft.VisualStudio.TestTools.UnitTesting.ClassInitializeAttribute"; | ||
private const string TESTFIXTURETEARDOWN_ATTR = "Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupAttribute"; | ||
private const string TESTSETUP_ATTR = "Microsoft.VisualStudio.TestTools.UnitTesting.TestInitializeAttribute"; | ||
private const string TESTTEARDOWN_ATTR = "Microsoft.VisualStudio.TestTools.UnitTesting.TestCleanupAttribute"; | ||
private const string IGNORE_ATTR = "Microsoft.VisualStudio.TestTools.UnitTesting.IgnoreAttribute"; | ||
private const string DESCRIPTION_ATTR = "Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute"; | ||
|
||
private const string FEATURE_TITILE_PROPERTY_NAME = "FeatureTitle"; | ||
private const string FEATURE_TITILE_KEY = "FeatureTitle"; | ||
|
||
private const string TESTCONTEXT_TYPE = "Microsoft.VisualStudio.TestTools.UnitTesting.TestContext"; | ||
|
||
private CodeTypeDeclaration currentTestTypeDeclaration = null; | ||
|
||
public void SetTestFixture(CodeTypeDeclaration typeDeclaration, string title, string description) | ||
{ | ||
typeDeclaration.CustomAttributes.Add( | ||
new CodeAttributeDeclaration( | ||
new CodeTypeReference(TESTFIXTURE_ATTR))); | ||
|
||
//as in mstest, you cannot mark classes with the description attribute, we | ||
//just remember the feature title, and we will apply it for each test method | ||
typeDeclaration.UserData[FEATURE_TITILE_KEY] = title; | ||
|
||
currentTestTypeDeclaration = typeDeclaration; | ||
} | ||
|
||
private void SetDescription(CodeAttributeDeclarationCollection customAttributes, string description) | ||
{ | ||
customAttributes.Add( | ||
new CodeAttributeDeclaration( | ||
new CodeTypeReference(DESCRIPTION_ATTR), | ||
new CodeAttributeArgument( | ||
new CodePrimitiveExpression(description)))); | ||
} | ||
|
||
private void SetProperty(CodeAttributeDeclarationCollection customAttributes, string name, string value) | ||
{ | ||
customAttributes.Add( | ||
new CodeAttributeDeclaration( | ||
new CodeTypeReference(PROPERTY_ATTR), | ||
new CodeAttributeArgument( | ||
new CodePrimitiveExpression(name)), | ||
new CodeAttributeArgument( | ||
new CodePrimitiveExpression(value)))); | ||
} | ||
|
||
public void SetTestFixtureCategories(CodeTypeDeclaration typeDeclaration, IEnumerable<string> categories) | ||
{ | ||
//MsTest does not support caregories... :( | ||
} | ||
|
||
public void SetTest(CodeMemberMethod memberMethod, string title) | ||
{ | ||
memberMethod.CustomAttributes.Add( | ||
new CodeAttributeDeclaration( | ||
new CodeTypeReference(TEST_ATTR))); | ||
|
||
SetDescription(memberMethod.CustomAttributes, title); | ||
|
||
if (currentTestTypeDeclaration == null) | ||
return; | ||
|
||
string featureTitle = currentTestTypeDeclaration.UserData[FEATURE_TITILE_KEY] as string; | ||
if (featureTitle != null) | ||
SetProperty(memberMethod.CustomAttributes, FEATURE_TITILE_PROPERTY_NAME, featureTitle); | ||
} | ||
|
||
public void SetTestCategories(CodeMemberMethod memberMethod, IEnumerable<string> categories) | ||
{ | ||
//MsTest does not support caregories... :( | ||
} | ||
|
||
public void SetTestSetup(CodeMemberMethod memberMethod) | ||
{ | ||
memberMethod.CustomAttributes.Add( | ||
new CodeAttributeDeclaration( | ||
new CodeTypeReference(TESTSETUP_ATTR))); | ||
} | ||
|
||
public void SetTestFixtureSetup(CodeMemberMethod memberMethod) | ||
{ | ||
memberMethod.Attributes |= MemberAttributes.Static; | ||
|
||
memberMethod.CustomAttributes.Add( | ||
new CodeAttributeDeclaration( | ||
new CodeTypeReference(TESTFIXTURESETUP_ATTR))); | ||
} | ||
|
||
public void SetTestFixtureTearDown(CodeMemberMethod memberMethod) | ||
{ | ||
memberMethod.Attributes |= MemberAttributes.Static; | ||
|
||
memberMethod.CustomAttributes.Add( | ||
new CodeAttributeDeclaration( | ||
new CodeTypeReference(TESTFIXTURETEARDOWN_ATTR))); | ||
} | ||
|
||
public void SetTestTearDown(CodeMemberMethod memberMethod) | ||
{ | ||
memberMethod.CustomAttributes.Add( | ||
new CodeAttributeDeclaration( | ||
new CodeTypeReference(TESTTEARDOWN_ATTR))); | ||
} | ||
|
||
public void SetIgnore(CodeTypeMember codeTypeMember) | ||
{ | ||
codeTypeMember.CustomAttributes.Add( | ||
new CodeAttributeDeclaration( | ||
new CodeTypeReference(IGNORE_ATTR))); | ||
} | ||
} | ||
} |
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
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 |
---|---|---|
@@ -1,13 +1,16 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> | ||
<Fragment> | ||
<ComponentGroup Id="Product.Generated"> | ||
<ComponentGroupRef Id="TechTalk.SpecFlow.Generator.Binaries" /> | ||
<ComponentGroupRef Id="TechTalk.SpecFlow.Parser.Binaries" /> | ||
<ComponentGroupRef Id="TechTalk.SpecFlow.Reporting.Binaries" /> | ||
<ComponentGroupRef Id="TechTalk.SpecFlow.Binaries" /> | ||
<ComponentGroupRef Id="TechTalk.SpecFlow.Tools.Binaries" /> | ||
<ComponentGroupRef Id="TechTalk.SpecFlow.VsIntegration.Binaries" /> | ||
</ComponentGroup> | ||
</Fragment> | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> | ||
<Fragment> | ||
<ComponentGroup Id="Product.Generated"> | ||
<ComponentGroupRef Id="TechTalk.SpecFlow.Generator.Binaries" /> | ||
<ComponentGroupRef Id="TechTalk.SpecFlow.Parser.Binaries" /> | ||
<ComponentGroupRef Id="TechTalk.SpecFlow.Reporting.Binaries" /> | ||
<ComponentGroupRef Id="TechTalk.SpecFlow.Silverlight.Binaries" /> | ||
<ComponentGroupRef Id="TechTalk.SpecFlow.Silverlight.Content" /> | ||
<ComponentGroupRef Id="TechTalk.SpecFlow.Silverlight.Satellites" /> | ||
<ComponentGroupRef Id="TechTalk.SpecFlow.Binaries" /> | ||
<ComponentGroupRef Id="TechTalk.SpecFlow.Tools.Binaries" /> | ||
<ComponentGroupRef Id="TechTalk.SpecFlow.VsIntegration.Binaries" /> | ||
</ComponentGroup> | ||
</Fragment> | ||
</Wix> |
Oops, something went wrong.