Skip to content

Commit

Permalink
Merged in upstream to master.
Browse files Browse the repository at this point in the history
  • Loading branch information
dragan committed Jun 18, 2010
2 parents d9eec72 + 0731e89 commit 35f02bc
Show file tree
Hide file tree
Showing 90 changed files with 11,759 additions and 700 deletions.
Binary file modified Documentation/SpecFlow Guide.docx
Binary file not shown.
3 changes: 3 additions & 0 deletions Generator/Configuration/GeneratorConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ private void SetUnitTestDefaultsByName(string name)
case "nunit":
GeneratorUnitTestProviderType = typeof(NUnitTestConverter);
break;
case "mbunit":
GeneratorUnitTestProviderType = typeof(MbUnitTestGeneratorProvider);
break;
case "xunit":
GeneratorUnitTestProviderType = typeof(XUnitTestGeneratorProvider);
break;
Expand Down
1 change: 1 addition & 0 deletions Generator/TechTalk.SpecFlow.Generator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SpecFlowGenerator.cs" />
<Compile Include="SpecFlowUnitTestConverter.cs" />
<Compile Include="UnitTestProvider\MbUnitTestGeneratorProvider.cs" />
<Compile Include="UnitTestProvider\XUnitTestGeneratorProvider.cs" />
<Compile Include="UnitTestProvider\IUnitTestGeneratorProvider.cs" />
<Compile Include="UnitTestProvider\MsTestGeneratorProvider.cs" />
Expand Down
104 changes: 104 additions & 0 deletions Generator/UnitTestProvider/MbUnitTestGeneratorProvider.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
using System;
using System.CodeDom;
using System.Collections.Generic;
using System.Linq;

namespace TechTalk.SpecFlow.Generator.UnitTestProvider
{
public class MbUnitTestGeneratorProvider : IUnitTestGeneratorProvider
{
private const string TESTFIXTURE_ATTR = "MbUnit.Framework.TestFixtureAttribute";
private const string TEST_ATTR = "MbUnit.Framework.TestAttribute";
private const string CATEGORY_ATTR = "MbUnit.Framework.CategoryAttribute";
private const string TESTSETUP_ATTR = "MbUnit.Framework.SetUpAttribute";
private const string TESTFIXTURESETUP_ATTR = "MbUnit.Framework.FixtureSetUpAttribute";
private const string TESTFIXTURETEARDOWN_ATTR = "MbUnit.Framework.FixtureTearDownAttribute";
private const string TESTTEARDOWN_ATTR = "MbUnit.Framework.TearDownAttribute";
private const string IGNORE_ATTR = "MbUnit.Framework.IgnoreAttribute";
private const string DESCRIPTION_ATTR = "MbUnit.Framework.DescriptionAttribute";

public void SetTestFixture(CodeTypeDeclaration typeDeclaration, string title, string description)
{
typeDeclaration.CustomAttributes.Add(
new CodeAttributeDeclaration(
new CodeTypeReference(TESTFIXTURE_ATTR)));

SetDescription(typeDeclaration.CustomAttributes, title);
}

private void SetDescription(CodeAttributeDeclarationCollection customAttributes, string description)
{
customAttributes.Add(
new CodeAttributeDeclaration(
new CodeTypeReference(DESCRIPTION_ATTR),
new CodeAttributeArgument(
new CodePrimitiveExpression(description))));
}

private void SetCategories(CodeAttributeDeclarationCollection customAttributes, IEnumerable<string> categories)
{
foreach (var category in categories)
{
customAttributes.Add(
new CodeAttributeDeclaration(
new CodeTypeReference(CATEGORY_ATTR),
new CodeAttributeArgument(
new CodePrimitiveExpression(category))));
}
}

public void SetTestFixtureCategories(CodeTypeDeclaration typeDeclaration, IEnumerable<string> categories)
{
SetCategories(typeDeclaration.CustomAttributes, categories);
}

public void SetTest(CodeMemberMethod memberMethod, string title)
{
memberMethod.CustomAttributes.Add(
new CodeAttributeDeclaration(
new CodeTypeReference(TEST_ATTR)));

SetDescription(memberMethod.CustomAttributes, title);
}

public void SetTestCategories(CodeMemberMethod memberMethod, IEnumerable<string> categories)
{
SetCategories(memberMethod.CustomAttributes, categories);
}

public void SetTestSetup(CodeMemberMethod memberMethod)
{
memberMethod.CustomAttributes.Add(
new CodeAttributeDeclaration(
new CodeTypeReference(TESTSETUP_ATTR)));
}

public void SetTestFixtureSetup(CodeMemberMethod memberMethod)
{
memberMethod.CustomAttributes.Add(
new CodeAttributeDeclaration(
new CodeTypeReference(TESTFIXTURESETUP_ATTR)));
}

public void SetTestFixtureTearDown(CodeMemberMethod memberMethod)
{
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)));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
<ItemGroup>
<Folder Include="Templates\" />
<Folder Include="Gui\" />
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
<Reference Include="MonoDevelop.Ide, Version=2.4.0.0, Culture=neutral, PublicKeyToken=null">
Expand All @@ -70,6 +71,10 @@
<ItemGroup>
<Compile Include="SingleFeatureFileGenerator.cs" />
<Compile Include="MonoDevelopProjectReader.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="..\..\VersionInfo.cs">
<Link>VersionInfo.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Generator\TechTalk.SpecFlow.Generator.csproj">
Expand Down
24 changes: 24 additions & 0 deletions IdeIntegration/MonoDevelopIntegration/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
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("MonoDevelop.TechTalk.SpecFlow")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("MonoDevelop.TechTalk.SpecFlow")]
[assembly: AssemblyCopyright("Copyright © TechTalk, SineSignal, LLC 2010")]
[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("0ACD56A4-7A81-11DF-93DF-699DDFD72085")]

1 change: 1 addition & 0 deletions Installer/ImportGherkinParser/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ private static void CreateSignedParser(string gherkinParserFullPath, Version ver
new Dictionary<string, string>()
{
{"se", "sv"},
{"lu", "lb-LU"},
};

private class KeywordTranslation
Expand Down
48 changes: 43 additions & 5 deletions Languages.xml
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,11 @@
<Scenario>Forgatókönyv</Scenario>
<ScenarioOutline>Forgatókönyv vázlat</ScenarioOutline>
<Examples>Példák</Examples>
<Given>Ha</Given>
<Given>Amennyiben</Given>
<Given>Adott</Given>
<When>Majd</When>
<When>Ha</When>
<When>Amikor</When>
<Then>Akkor</Then>
<And>És</And>
<But>De</But>
Expand Down Expand Up @@ -250,8 +253,11 @@
<Scenario>Forgatókönyv</Scenario>
<ScenarioOutline>Forgatókönyv vázlat</ScenarioOutline>
<Examples>Példák</Examples>
<Given>Ha</Given>
<Given>Amennyiben</Given>
<Given>Adott</Given>
<When>Majd</When>
<When>Ha</When>
<When>Amikor</When>
<Then>Akkor</Then>
<And>És</And>
<But>De</But>
Expand All @@ -262,8 +268,11 @@
<Scenario>Forgatókönyv</Scenario>
<ScenarioOutline>Forgatókönyv vázlat</ScenarioOutline>
<Examples>Példák</Examples>
<Given>Ha</Given>
<Given>Amennyiben</Given>
<Given>Adott</Given>
<When>Majd</When>
<When>Ha</When>
<When>Amikor</When>
<Then>Akkor</Then>
<And>És</And>
<But>De</But>
Expand Down Expand Up @@ -328,6 +337,20 @@
<And>Ir</And>
<But>Bet</But>
</Language>
<Language code="lb-LU" cultureInfo="lb-LU" compatibleGherkinCode="lu" englishName="Luxembourgish (Luxembourg)">
<Feature>Funktionalitéit</Feature>
<Background>Hannergrond</Background>
<Scenario>Szenario</Scenario>
<ScenarioOutline>Plang vum Szenario</ScenarioOutline>
<Examples>Beispiller</Examples>
<Given>ugeholl</Given>
<When>wann</When>
<Then>dann</Then>
<And>an</And>
<And>a</And>
<But>awer</But>
<But>mä</But>
</Language>
<Language code="lv" cultureInfo="lv" defaultSpecificCulture="lv-LV" englishName="Latvian">
<Feature>Funkcionalitāte</Feature>
<Feature>Fīča</Feature>
Expand Down Expand Up @@ -427,8 +450,12 @@
<ScenarioOutline>Структура сценария</ScenarioOutline>
<Examples>Значения</Examples>
<Given>Допустим</Given>
<Given>Дано</Given>
<Given>Пусть</Given>
<When>Если</When>
<When>Когда</When>
<Then>То</Then>
<Then>Тогда</Then>
<And>И</And>
<And>К тому же</And>
<But>Но</But>
Expand All @@ -452,8 +479,11 @@
<Scenario>Forgatókönyv</Scenario>
<ScenarioOutline>Forgatókönyv vázlat</ScenarioOutline>
<Examples>Példák</Examples>
<Given>Ha</Given>
<Given>Amennyiben</Given>
<Given>Adott</Given>
<When>Majd</When>
<When>Ha</When>
<When>Amikor</When>
<Then>Akkor</Then>
<And>És</And>
<But>De</But>
Expand All @@ -464,8 +494,11 @@
<Scenario>Forgatókönyv</Scenario>
<ScenarioOutline>Forgatókönyv vázlat</ScenarioOutline>
<Examples>Példák</Examples>
<Given>Ha</Given>
<Given>Amennyiben</Given>
<Given>Adott</Given>
<When>Majd</When>
<When>Ha</When>
<When>Amikor</When>
<Then>Akkor</Then>
<And>És</And>
<But>De</But>
Expand Down Expand Up @@ -504,9 +537,14 @@
<Given>Припустимо</Given>
<Given>Припустимо, що</Given>
<Given>Нехай</Given>
<Given>Дано</Given>
<When>Якщо</When>
<When>Коли</When>
<Then>То</Then>
<Then>Тоді</Then>
<And>І</And>
<And>А також</And>
<And>Та</And>
<But>Але</But>
</Language>
<Language code="uz" cultureInfo="uz" defaultSpecificCulture="uz-Cyrl-UZ" englishName="Uzbek">
Expand Down
4 changes: 2 additions & 2 deletions Parser/GherkinBuilder/BackgroundBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ internal class BackgroundBuilder : IStepProcessor
private readonly FilePosition position;
private readonly IList<StepBuilder> steps = new List<StepBuilder>();

public BackgroundBuilder(string text, FilePosition position)
public BackgroundBuilder(string name, string description, FilePosition position)
{
this.text = text;
this.text = TextHelper.GetText(name, description);
this.position = position;
}

Expand Down
4 changes: 2 additions & 2 deletions Parser/GherkinBuilder/ExampleBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ internal class ExampleBuilder : ITableProcessor
private readonly FilePosition position;
private readonly TableBuilder tableBuilder = new TableBuilder();

public ExampleBuilder(string text, FilePosition position)
public ExampleBuilder(string name, string description, FilePosition position)
{
this.text = text;
this.text = TextHelper.GetText(name, description);
this.position = position;
}

Expand Down
34 changes: 16 additions & 18 deletions Parser/GherkinBuilder/FeatureBuilder.cs
Original file line number Diff line number Diff line change
@@ -1,43 +1,41 @@
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using TechTalk.SpecFlow.Parser.SyntaxElements;

namespace TechTalk.SpecFlow.Parser.GherkinBuilder
{
internal class FeatureBuilder
{
private readonly string text;
private readonly Tags tags;
private string title;
private string description;
private string sourceFilePath;
private Tags tags;
private readonly IList<IScenarioBuilder> scenarios = new List<IScenarioBuilder>();
private BackgroundBuilder background = null;

public FeatureBuilder(string text, Tags tags)
public string SourceFilePath
{
this.text = text;
this.tags = tags;
get { return sourceFilePath; }
set { sourceFilePath = value; }
}

private static readonly Regex firstLineRe = new Regex(@"^(?<firstline>[^\r\n]*)[\r\n]+(?<rest>.*)", RegexOptions.Singleline);
public void SetHeader(string title, string description, Tags tags)
{
this.title = title;
this.description = description;
this.tags = tags;
}

public Feature GetResult()
{
string title = text;
string description = null;

var match = firstLineRe.Match(text);
if (match.Success)
{
title = match.Groups["firstline"].Value;
description = match.Groups["rest"].Value;
}

return new Feature(
var feature = new Feature(
title,
tags,
description,
background == null ? null : background.GetResult(),
scenarios.Select(sb => sb.GetResult()).ToArray());
feature.SourceFile = sourceFilePath;
return feature;
}

public void AddScenario(IScenarioBuilder scenarioBuilder)
Expand Down
Loading

0 comments on commit 35f02bc

Please sign in to comment.