Update it all, VisualStudio Changes
This commit is contained in:
15
csharp/bob/Bob.cs
Normal file
15
csharp/bob/Bob.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
internal class Bob {
|
||||
public static string Hey(string inp) {
|
||||
inp = inp.Trim();
|
||||
if(inp == "") {
|
||||
return "Fine. Be that way!";
|
||||
}
|
||||
if(inp == inp.ToUpper() && inp != inp.ToLower()) {
|
||||
return "Whoa, chill out!";
|
||||
}
|
||||
if(inp[inp.Length-1] == '?') {
|
||||
return "Sure.";
|
||||
}
|
||||
return "Whatever.";
|
||||
}
|
||||
}
|
131
csharp/bob/BobTest.cs
Normal file
131
csharp/bob/BobTest.cs
Normal file
@@ -0,0 +1,131 @@
|
||||
using NUnit.Framework;
|
||||
|
||||
[TestFixture]
|
||||
public class BobTest
|
||||
{
|
||||
[Ignore]
|
||||
[Test]
|
||||
public void Stating_something ()
|
||||
{
|
||||
Assert.That(Bob.Hey("Tom-ay-to, tom-aaaah-to."), Is.EqualTo("Whatever."));
|
||||
}
|
||||
|
||||
[Ignore]
|
||||
[Test]
|
||||
public void Shouting ()
|
||||
{
|
||||
Assert.That(Bob.Hey("WATCH OUT!"), Is.EqualTo("Whoa, chill out!"));
|
||||
}
|
||||
|
||||
[Ignore]
|
||||
[Test]
|
||||
public void Asking_a_question ()
|
||||
{
|
||||
Assert.That(Bob.Hey("Does this cryogenic chamber make me look fat?"), Is.EqualTo("Sure."));
|
||||
}
|
||||
|
||||
[Ignore]
|
||||
[Test]
|
||||
public void Asking_a_question_with_a_trailing_space()
|
||||
{
|
||||
Assert.That(Bob.Hey("Do I like my spacebar too much? "), Is.EqualTo("Sure."));
|
||||
}
|
||||
|
||||
[Ignore]
|
||||
[Test]
|
||||
public void Asking_a_numeric_question ()
|
||||
{
|
||||
Assert.That(Bob.Hey("You are, what, like 15?"), Is.EqualTo("Sure."));
|
||||
}
|
||||
|
||||
[Ignore]
|
||||
[Test]
|
||||
public void Talking_forcefully ()
|
||||
{
|
||||
Assert.That(Bob.Hey("Let's go make out behind the gym!"), Is.EqualTo("Whatever."));
|
||||
}
|
||||
|
||||
[Ignore]
|
||||
[Test]
|
||||
public void Using_acronyms_in_regular_search ()
|
||||
{
|
||||
Assert.That(Bob.Hey("It's OK if you don't want to go to the DMV."), Is.EqualTo("Whatever."));
|
||||
}
|
||||
|
||||
[Ignore]
|
||||
[Test]
|
||||
public void Forceful_questions ()
|
||||
{
|
||||
Assert.That(Bob.Hey("WHAT THE HELL WERE YOU THINKING?"), Is.EqualTo("Whoa, chill out!"));
|
||||
}
|
||||
|
||||
[Ignore]
|
||||
[Test]
|
||||
public void Shouting_numbers ()
|
||||
{
|
||||
Assert.That(Bob.Hey("1, 2, 3 GO!"), Is.EqualTo("Whoa, chill out!"));
|
||||
}
|
||||
|
||||
[Ignore]
|
||||
[Test]
|
||||
public void Only_numbers ()
|
||||
{
|
||||
Assert.That(Bob.Hey("1, 2, 3"), Is.EqualTo("Whatever."));
|
||||
}
|
||||
|
||||
[Ignore]
|
||||
[Test]
|
||||
public void Question_with_only_numbers ()
|
||||
{
|
||||
Assert.That(Bob.Hey("4?"), Is.EqualTo("Sure."));
|
||||
}
|
||||
|
||||
[Ignore]
|
||||
[Test]
|
||||
public void Shouting_with_special_characters ()
|
||||
{
|
||||
Assert.That(Bob.Hey("ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!"), Is.EqualTo("Whoa, chill out!"));
|
||||
}
|
||||
|
||||
[Ignore]
|
||||
[Test]
|
||||
public void Shouting_with_no_exclamation_mark ()
|
||||
{
|
||||
Assert.That(Bob.Hey("I HATE YOU"), Is.EqualTo("Whoa, chill out!"));
|
||||
}
|
||||
|
||||
[Ignore]
|
||||
[Test]
|
||||
public void Statement_containing_question_mark ()
|
||||
{
|
||||
Assert.That(Bob.Hey("Ending with ? means a question."), Is.EqualTo("Whatever."));
|
||||
}
|
||||
|
||||
[Ignore]
|
||||
[Test]
|
||||
public void Prattling_on ()
|
||||
{
|
||||
Assert.That(Bob.Hey("Wait! Hang on. Are you going to be OK?"), Is.EqualTo("Sure."));
|
||||
}
|
||||
|
||||
[Ignore]
|
||||
[Test]
|
||||
public void Silence ()
|
||||
{
|
||||
Assert.That(Bob.Hey(""), Is.EqualTo("Fine. Be that way!"));
|
||||
}
|
||||
|
||||
[Ignore]
|
||||
[Test]
|
||||
public void Prolonged_silence ()
|
||||
{
|
||||
Assert.That(Bob.Hey(" "), Is.EqualTo("Fine. Be that way!"));
|
||||
}
|
||||
|
||||
[Ignore]
|
||||
[Test]
|
||||
public void Multiple_line_question ()
|
||||
{
|
||||
Assert.That(Bob.Hey("Does this cryogenic chamber make me look fat?\nno"), Is.EqualTo("Whatever."));
|
||||
}
|
||||
}
|
44
csharp/bob/README.md
Normal file
44
csharp/bob/README.md
Normal file
@@ -0,0 +1,44 @@
|
||||
# Bob
|
||||
|
||||
Bob is a lackadaisical teenager. In conversation, his responses are very limited.
|
||||
|
||||
Bob answers 'Sure.' if you ask him a question.
|
||||
|
||||
He answers 'Whoa, chill out!' if you yell at him.
|
||||
|
||||
He says 'Fine. Be that way!' if you address him without actually saying
|
||||
anything.
|
||||
|
||||
He answers 'Whatever.' to anything else.
|
||||
|
||||
## Instructions
|
||||
|
||||
Run the test file, and fix each of the errors in turn. When you get the
|
||||
first test to pass, go to the first pending or skipped test, and make
|
||||
that pass as well. When all of the tests are passing, feel free to
|
||||
submit.
|
||||
|
||||
Remember that passing code is just the first step. The goal is to work
|
||||
towards a solution that is as readable and expressive as you can make
|
||||
it.
|
||||
|
||||
Please make your solution as general as possible. Good code doesn't just
|
||||
pass the test suite, it works with any input that fits the
|
||||
specification.
|
||||
|
||||
Have fun!
|
||||
|
||||
|
||||
### Submitting Exercises
|
||||
|
||||
Note that, when trying to submit an exercise, make sure you're exercise file you're submitting is in the `exercism/csharp/<exerciseName>` directory.
|
||||
|
||||
For example, if you're submitting `bob.cs` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/csharp/bob/bob.cs`.
|
||||
|
||||
## Source
|
||||
|
||||
Inspired by the 'Deaf Grandma' exercise in Chris Pine's Learn to Program tutorial. [http://pine.fm/LearnToProgram/?Chapter=06](http://pine.fm/LearnToProgram/?Chapter=06)
|
||||
|
||||
## Submitting Incomplete Problems
|
||||
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
||||
|
Reference in New Issue
Block a user