From a97c57afdf40dce486d5bc567ca5b0318314c10f Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Mon, 20 Mar 2017 16:35:15 +0100 Subject: [PATCH] Add isogram exercise generator Refs #194, #195 --- exercises/isogram/Example.cs | 4 +- exercises/isogram/IsogramTest.cs | 62 +++++++++++++++++++------ generators/Exercises/IsogramExercise.cs | 9 ++++ 3 files changed, 58 insertions(+), 17 deletions(-) create mode 100644 generators/Exercises/IsogramExercise.cs diff --git a/exercises/isogram/Example.cs b/exercises/isogram/Example.cs index 722cbc043c..ff813f1dab 100644 --- a/exercises/isogram/Example.cs +++ b/exercises/isogram/Example.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -public class Isogram +public static class Isogram { public static bool IsIsogram(string word) { @@ -17,4 +17,4 @@ public static bool IsIsogram(string word) return true; } -} +} \ No newline at end of file diff --git a/exercises/isogram/IsogramTest.cs b/exercises/isogram/IsogramTest.cs index bb22e6afd9..c140c598ca 100644 --- a/exercises/isogram/IsogramTest.cs +++ b/exercises/isogram/IsogramTest.cs @@ -1,20 +1,52 @@ -using Xunit; +using Xunit; public class IsogramTest { - [Theory] - [InlineData("duplicates", true)] - [InlineData("eleven", false)] - [InlineData("subdermatoglyphic", true)] - [InlineData("Alphabet", false)] - [InlineData("thumbscrew-japingly", true)] - [InlineData("Hjelmqvist-Gryb-Zock-Pfund-Wax", true)] - [InlineData("Heizölrückstoßabdämpfung", true)] - [InlineData("the quick brown fox", false)] - [InlineData("Emily Jung Schwartzkopf", true)] - [InlineData("éléphant", false)] - public void Isogram_correctly_detects_isograms(string input, bool expected) - { - Assert.Equal(expected, Isogram.IsIsogram(input)); + [Fact] + public void Empty_string() + { + Assert.True(Isogram.IsIsogram("")); + } + + [Fact(Skip = "Remove to run test")] + public void Isogram_with_only_lower_case_characters() + { + Assert.True(Isogram.IsIsogram("isogram")); + } + + [Fact(Skip = "Remove to run test")] + public void Word_with_one_duplicated_character() + { + Assert.False(Isogram.IsIsogram("eleven")); + } + + [Fact(Skip = "Remove to run test")] + public void Longest_reported_english_isogram() + { + Assert.True(Isogram.IsIsogram("subdermatoglyphic")); + } + + [Fact(Skip = "Remove to run test")] + public void Word_with_duplicated_character_in_mixed_case() + { + Assert.False(Isogram.IsIsogram("Alphabet")); + } + + [Fact(Skip = "Remove to run test")] + public void Hypothetical_isogrammic_word_with_hyphen() + { + Assert.True(Isogram.IsIsogram("thumbscrew-japingly")); + } + + [Fact(Skip = "Remove to run test")] + public void Isogram_with_duplicated_non_letter_character() + { + Assert.True(Isogram.IsIsogram("Hjelmqvist-Gryb-Zock-Pfund-Wax")); + } + + [Fact(Skip = "Remove to run test")] + public void Made_up_name_that_is_an_isogram() + { + Assert.True(Isogram.IsIsogram("Emily Jung Schwartzkopf")); } } \ No newline at end of file diff --git a/generators/Exercises/IsogramExercise.cs b/generators/Exercises/IsogramExercise.cs new file mode 100644 index 0000000000..ac422da9bc --- /dev/null +++ b/generators/Exercises/IsogramExercise.cs @@ -0,0 +1,9 @@ +namespace Generators.Exercises +{ + public class IsogramExercise : BooleanExercise + { + public IsogramExercise() : base("isogram") + { + } + } +} \ No newline at end of file