Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add version of canonical data to generated test file #301

Merged
merged 1 commit into from
Jun 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions exercises/acronym/AcronymTest.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// This file was auto-generated based on version 1.1.0 of the canonical data.

using Xunit;

public class AcronymTest
Expand All @@ -14,12 +16,6 @@ public void Lowercase_words()
Assert.Equal("ROR", Acronym.Abbreviate("Ruby on Rails"));
}

[Fact(Skip = "Remove to run test")]
public void PascalCase()
{
Assert.Equal("HTML", Acronym.Abbreviate("HyperText Markup Language"));
}

[Fact(Skip = "Remove to run test")]
public void Punctuation()
{
Expand All @@ -43,4 +39,4 @@ public void Hyphenated()
{
Assert.Equal("CMOS", Acronym.Abbreviate("Complementary metal-oxide semiconductor"));
}
}
}
2 changes: 2 additions & 0 deletions exercises/atbash-cipher/AtbashCipherTest.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// This file was auto-generated based on version 1.0.0 of the canonical data.

using Xunit;

public class AtbashCipherTest
Expand Down
16 changes: 9 additions & 7 deletions exercises/beer-song/BeerSongTest.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// This file was auto-generated based on version 1.0.0 of the canonical data.

using Xunit;

public class BeerSongTest
Expand All @@ -12,7 +14,7 @@ public void First_generic_verse()
Assert.Equal(expected, BeerSong.Verse(99));
}

[Fact]
[Fact(Skip = "Remove to run test")]
public void Last_generic_verse()
{
var expected =
Expand All @@ -22,7 +24,7 @@ public void Last_generic_verse()
Assert.Equal(expected, BeerSong.Verse(3));
}

[Fact]
[Fact(Skip = "Remove to run test")]
public void Verse_2()
{
var expected =
Expand All @@ -32,7 +34,7 @@ public void Verse_2()
Assert.Equal(expected, BeerSong.Verse(2));
}

[Fact]
[Fact(Skip = "Remove to run test")]
public void Verse_1()
{
var expected =
Expand All @@ -42,7 +44,7 @@ public void Verse_1()
Assert.Equal(expected, BeerSong.Verse(1));
}

[Fact]
[Fact(Skip = "Remove to run test")]
public void Verse_0()
{
var expected =
Expand All @@ -52,7 +54,7 @@ public void Verse_0()
Assert.Equal(expected, BeerSong.Verse(0));
}

[Fact]
[Fact(Skip = "Remove to run test")]
public void First_two_verses()
{
var expected =
Expand All @@ -65,7 +67,7 @@ public void First_two_verses()
Assert.Equal(expected, BeerSong.Verses(99, 98));
}

[Fact]
[Fact(Skip = "Remove to run test")]
public void Last_three_verses()
{
var expected =
Expand All @@ -81,7 +83,7 @@ public void Last_three_verses()
Assert.Equal(expected, BeerSong.Verses(2, 0));
}

[Fact]
[Fact(Skip = "Remove to run test")]
public void All_verses()
{
var expected =
Expand Down
2 changes: 2 additions & 0 deletions exercises/food-chain/FoodChainTest.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// This file was auto-generated based on version 1.0.0 of the canonical data.

using Xunit;

public class FoodChainTest
Expand Down
8 changes: 5 additions & 3 deletions exercises/hello-world/HelloWorldTest.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
using Xunit;
// This file was auto-generated based on version 1.0.0 of the canonical data.

using Xunit;

public class HelloWorldTest
{
[Fact]
public void Say_hi()
public void Say_hi_()
{
Assert.Equal("Hello, World!", HelloWorld.Hello());
}
}
}
8 changes: 8 additions & 0 deletions exercises/isogram/IsogramTest.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// This file was auto-generated based on version 1.1.0 of the canonical data.

using Xunit;

public class IsogramTest
Expand Down Expand Up @@ -49,4 +51,10 @@ public void Made_up_name_that_is_an_isogram()
{
Assert.True(Isogram.IsIsogram("Emily Jung Schwartzkopf"));
}

[Fact(Skip = "Remove to run test")]
public void Duplicated_character_in_the_middle()
{
Assert.False(Isogram.IsIsogram("accentor"));
}
}
2 changes: 2 additions & 0 deletions exercises/leap/LeapTest.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// This file was auto-generated based on version 1.0.0 of the canonical data.

using Xunit;

public class LeapTest
Expand Down
2 changes: 2 additions & 0 deletions exercises/luhn/LuhnTest.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// This file was auto-generated based on version 1.0.0 of the canonical data.

using Xunit;

public class LuhnTest
Expand Down
2 changes: 2 additions & 0 deletions exercises/nth-prime/NthPrimeTest.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// This file was auto-generated based on version 1.0.0 of the canonical data.

using Xunit;
using System;

Expand Down
2 changes: 2 additions & 0 deletions exercises/perfect-numbers/PerfectNumbersTest.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// This file was auto-generated based on version 1.0.1 of the canonical data.

using Xunit;
using System;

Expand Down
2 changes: 2 additions & 0 deletions exercises/pig-latin/PigLatinTest.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// This file was auto-generated based on version 1.0.0 of the canonical data.

using Xunit;

public class PigLatinTest
Expand Down
2 changes: 2 additions & 0 deletions exercises/raindrops/RaindropsTest.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// This file was auto-generated based on version 1.0.0 of the canonical data.

using Xunit;

public class RaindropsTest
Expand Down
2 changes: 2 additions & 0 deletions exercises/roman-numerals/RomanNumeralsTest.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// This file was auto-generated based on version 1.0.0 of the canonical data.

using Xunit;

public class RomanNumeralsTest
Expand Down
2 changes: 2 additions & 0 deletions exercises/rotational-cipher/RotationalCipherTest.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// This file was auto-generated based on version 1.0.0 of the canonical data.

using Xunit;

public class RotationalCipherTest
Expand Down
2 changes: 2 additions & 0 deletions exercises/wordy/WordyTest.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// This file was auto-generated based on version 1.0.0 of the canonical data.

using Xunit;
using System;

Expand Down
1 change: 1 addition & 0 deletions generators/Classes/TestClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ public class TestClass
public string BeforeTestMethods { get; set; }
public TestMethod[] TestMethods { get; set; }
public string AfterTestMethods { get; set; }
public string CanonicalDataVersion { get; set; }
}
}
5 changes: 4 additions & 1 deletion generators/Classes/TestClassRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ namespace Generators.Classes
public static class TestClassRenderer
{
private const string TestClassTemplate =
@"{UsingNamespaces}
@"// This file was auto-generated based on version {CanonicalDataVersion} of the canonical data.

{UsingNamespaces}

public class {ClassName}
{
Expand All @@ -16,6 +18,7 @@ public class {ClassName}

public static string Render(TestClass testClass) =>
TestClassTemplate
.Replace("{CanonicalDataVersion}", testClass.CanonicalDataVersion)
.Replace("{UsingNamespaces}", RenderUsingNamespaces(testClass))
.Replace("{ClassName}", testClass.ClassName)
.Replace("{Body}", RenderBody(testClass));
Expand Down
3 changes: 2 additions & 1 deletion generators/Exercises/Exercise.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ public TestClass CreateTestClass(CanonicalData canonicalData)
var testClass = new TestClass
{
ClassName = Name.Transform(To.TestClassName),
TestMethods = CreateTestMethods(canonicalData).ToArray()
TestMethods = CreateTestMethods(canonicalData).ToArray(),
CanonicalDataVersion = canonicalData.Version
};

AddTestMethodUsingNamespaces(testClass);
Expand Down