Skip to content
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
2 changes: 1 addition & 1 deletion docs/TESTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dotnet test

## Solving the exercise

Solving an exercise means making all its tests pass. By default, only one test (the first one) is executed when you run the tests. This is intentional, as it allows you to focus on just making that one test pass. Once it passes, you can enable the next test by removing `Skip = "Remove to run test"` from the test's `[Fact]` or `[Theory]` attribute. When all tests have been enabled and your implementation makes them all pass, you'll have solved the exercise!
Solving an exercise means making all its tests pass. By default, only one test (the first one) is executed when you run the tests. This is intentional, as it allows you to focus on just making that one test pass. Once it passes, you can enable the next test by removing `Skip = "Remove this Skip property to run this test"` from the test's `[Fact]` or `[Theory]` attribute. When all tests have been enabled and your implementation makes them all pass, you'll have solved the exercise!

To help you get started, each exercise comes with a stub implementation file. You can use this file as a starting point for building your solution. Feel free to remove or change this file if you think it is the right thing to do.

Expand Down
12 changes: 6 additions & 6 deletions exercises/accumulate/AccumulateTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ public void Empty_accumulation_produces_empty_accumulation()
Assert.Equal(new int[0], new int[0].Accumulate(x => x * x));
}

[Fact(Skip = "Remove to run test")]
[Fact(Skip = "Remove this Skip property to run this test")]
public void Accumulate_squares()
{
Assert.Equal(new[] { 1, 4, 9 }, new[] { 1, 2, 3 }.Accumulate(x => x * x));
}

[Fact(Skip = "Remove to run test")]
[Fact(Skip = "Remove this Skip property to run this test")]
public void Accumulate_upcases()
{
Assert.Equal(new List<string> { "HELLO", "WORLD" }, new List<string> { "hello", "world" }.Accumulate(x => x.ToUpper()));
}

[Fact(Skip = "Remove to run test")]
[Fact(Skip = "Remove this Skip property to run this test")]
public void Accumulate_reversed_strings()
{
Assert.Equal("eht kciuq nworb xof cte".Split(' '), "the quick brown fox etc".Split(' ').Accumulate(Reverse));
Expand All @@ -36,15 +36,15 @@ private static string Reverse(string value)
return new string(array);
}

[Fact(Skip = "Remove to run test")]
[Fact(Skip = "Remove this Skip property to run this test")]
public void Accumulate_within_accumulate()
{
var actual = new[] { "a", "b", "c" }.Accumulate(c =>
string.Join(" ", new[] { "1", "2", "3" }.Accumulate(d => c + d)));
Assert.Equal(new[] { "a1 a2 a3", "b1 b2 b3", "c1 c2 c3" }, actual);
}

[Fact(Skip = "Remove to run test")]
[Fact(Skip = "Remove this Skip property to run this test")]
public void Accumulate_is_lazy()
{
var counter = 0;
Expand All @@ -55,7 +55,7 @@ public void Accumulate_is_lazy()
Assert.Equal(3, counter);
}

[Fact(Skip = "Remove to run test")]
[Fact(Skip = "Remove this Skip property to run this test")]
public void Accumulate_allows_different_return_type()
{
Assert.Equal(new[] { "1", "2", "3" }, new[] { 1, 2, 3 }.Accumulate(x => x.ToString()));
Expand Down
16 changes: 8 additions & 8 deletions exercises/acronym/AcronymTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,49 +10,49 @@ public void Basic()
Assert.Equal("PNG", Acronym.Abbreviate("Portable Network Graphics"));
}

[Fact(Skip = "Remove to run test")]
[Fact(Skip = "Remove this Skip property to run this test")]
public void Lowercase_words()
{
Assert.Equal("ROR", Acronym.Abbreviate("Ruby on Rails"));
}

[Fact(Skip = "Remove to run test")]
[Fact(Skip = "Remove this Skip property to run this test")]
public void Punctuation()
{
Assert.Equal("FIFO", Acronym.Abbreviate("First In, First Out"));
}

[Fact(Skip = "Remove to run test")]
[Fact(Skip = "Remove this Skip property to run this test")]
public void All_caps_word()
{
Assert.Equal("GIMP", Acronym.Abbreviate("GNU Image Manipulation Program"));
}

[Fact(Skip = "Remove to run test")]
[Fact(Skip = "Remove this Skip property to run this test")]
public void Punctuation_without_whitespace()
{
Assert.Equal("CMOS", Acronym.Abbreviate("Complementary metal-oxide semiconductor"));
}

[Fact(Skip = "Remove to run test")]
[Fact(Skip = "Remove this Skip property to run this test")]
public void Very_long_abbreviation()
{
Assert.Equal("ROTFLSHTMDCOALM", Acronym.Abbreviate("Rolling On The Floor Laughing So Hard That My Dogs Came Over And Licked Me"));
}

[Fact(Skip = "Remove to run test")]
[Fact(Skip = "Remove this Skip property to run this test")]
public void Consecutive_delimiters()
{
Assert.Equal("SIMUFTA", Acronym.Abbreviate("Something - I made up from thin air"));
}

[Fact(Skip = "Remove to run test")]
[Fact(Skip = "Remove this Skip property to run this test")]
public void Apostrophes()
{
Assert.Equal("HC", Acronym.Abbreviate("Halley's Comet"));
}

[Fact(Skip = "Remove to run test")]
[Fact(Skip = "Remove this Skip property to run this test")]
public void Underscore_emphasis()
{
Assert.Equal("TRNT", Acronym.Abbreviate("The Road _Not_ Taken"));
Expand Down
30 changes: 15 additions & 15 deletions exercises/affine-cipher/AffineCipherTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,91 +11,91 @@ public void Encode_yes()
Assert.Equal("xbt", AffineCipher.Encode("yes", 5, 7));
}

[Fact(Skip = "Remove to run test")]
[Fact(Skip = "Remove this Skip property to run this test")]
public void Encode_no()
{
Assert.Equal("fu", AffineCipher.Encode("no", 15, 18));
}

[Fact(Skip = "Remove to run test")]
[Fact(Skip = "Remove this Skip property to run this test")]
public void Encode_omg()
{
Assert.Equal("lvz", AffineCipher.Encode("OMG", 21, 3));
}

[Fact(Skip = "Remove to run test")]
[Fact(Skip = "Remove this Skip property to run this test")]
public void Encode_o_m_g()
{
Assert.Equal("hjp", AffineCipher.Encode("O M G", 25, 47));
}

[Fact(Skip = "Remove to run test")]
[Fact(Skip = "Remove this Skip property to run this test")]
public void Encode_mindblowingly()
{
Assert.Equal("rzcwa gnxzc dgt", AffineCipher.Encode("mindblowingly", 11, 15));
}

[Fact(Skip = "Remove to run test")]
[Fact(Skip = "Remove this Skip property to run this test")]
public void Encode_numbers()
{
Assert.Equal("jqgjc rw123 jqgjc rw", AffineCipher.Encode("Testing,1 2 3, testing.", 3, 4));
}

[Fact(Skip = "Remove to run test")]
[Fact(Skip = "Remove this Skip property to run this test")]
public void Encode_deep_thought()
{
Assert.Equal("iynia fdqfb ifje", AffineCipher.Encode("Truth is fiction.", 5, 17));
}

[Fact(Skip = "Remove to run test")]
[Fact(Skip = "Remove this Skip property to run this test")]
public void Encode_all_the_letters()
{
Assert.Equal("swxtj npvyk lruol iejdc blaxk swxmh qzglf", AffineCipher.Encode("The quick brown fox jumps over the lazy dog.", 17, 33));
}

[Fact(Skip = "Remove to run test")]
[Fact(Skip = "Remove this Skip property to run this test")]
public void Encode_with_a_not_coprime_to_m()
{
Assert.Throws<ArgumentException>(() => AffineCipher.Encode("This is a test.", 6, 17));
}

[Fact(Skip = "Remove to run test")]
[Fact(Skip = "Remove this Skip property to run this test")]
public void Decode_exercism()
{
Assert.Equal("exercism", AffineCipher.Decode("tytgn fjr", 3, 7));
}

[Fact(Skip = "Remove to run test")]
[Fact(Skip = "Remove this Skip property to run this test")]
public void Decode_a_sentence()
{
Assert.Equal("anobstacleisoftenasteppingstone", AffineCipher.Decode("qdwju nqcro muwhn odqun oppmd aunwd o", 19, 16));
}

[Fact(Skip = "Remove to run test")]
[Fact(Skip = "Remove this Skip property to run this test")]
public void Decode_numbers()
{
Assert.Equal("testing123testing", AffineCipher.Decode("odpoz ub123 odpoz ub", 25, 7));
}

[Fact(Skip = "Remove to run test")]
[Fact(Skip = "Remove this Skip property to run this test")]
public void Decode_all_the_letters()
{
Assert.Equal("thequickbrownfoxjumpsoverthelazydog", AffineCipher.Decode("swxtj npvyk lruol iejdc blaxk swxmh qzglf", 17, 33));
}

[Fact(Skip = "Remove to run test")]
[Fact(Skip = "Remove this Skip property to run this test")]
public void Decode_with_no_spaces_in_input()
{
Assert.Equal("thequickbrownfoxjumpsoverthelazydog", AffineCipher.Decode("swxtjnpvyklruoliejdcblaxkswxmhqzglf", 17, 33));
}

[Fact(Skip = "Remove to run test")]
[Fact(Skip = "Remove this Skip property to run this test")]
public void Decode_with_too_many_spaces()
{
Assert.Equal("jollygreengiant", AffineCipher.Decode("vszzm cly yd cg qdp", 15, 16));
}

[Fact(Skip = "Remove to run test")]
[Fact(Skip = "Remove this Skip property to run this test")]
public void Decode_with_a_not_coprime_to_m()
{
Assert.Throws<ArgumentException>(() => AffineCipher.Decode("Test", 13, 5));
Expand Down
Loading