Skip to content
Permalink
Browse files

Game - add cliff fall to AuxiliaryRoom, covered in WalkthroughDieTest

  • Loading branch information...
bobbymcr committed Dec 22, 2018
1 parent 58a860f commit 98d501924953d4c5a37ef10c67250ad8980f091f
@@ -11,6 +11,17 @@ public AuxiliaryRoom(MessageBus bus)
{
}

protected override string Description => "You are in the auxiliary room. There is a doorway to the west.";
protected override string Description => "You are in the auxiliary room. There is a doorway to the west. There is a cliff to the east.";

protected override bool GoCore(Word noun)
{
if (noun.Primary == Noun.East)
{
this.End("You fall off a cliff. Game over.");
return true;
}

return base.GoCore(noun);
}
}
}
@@ -17,10 +17,16 @@
<ProjectReference Include="..\src\Adventure.Sample.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="walkthrough.in">
<None Update="walkthrough.die.out">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="walkthrough.out">
<None Update="walkthrough.die.in">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="walkthrough.quit.in">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="walkthrough.quit.out">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
@@ -11,12 +11,27 @@ namespace Adventure.Sample.Test
public sealed class GameTest
{
[Fact]
public void WalkthroughTest()
public void WalkthroughQuitTest()
{
const string ActualOut = "walkthrough.actual.out";
const string ExpectedOut = "walkthrough.out";
const string ActualOut = "walkthrough.quit.actual.out";
const string ExpectedOut = "walkthrough.quit.out";

using (StreamReader reader = new StreamReader("walkthrough.in"))
using (StreamReader reader = new StreamReader("walkthrough.quit.in"))
using (StreamWriter writer = new StreamWriter(ActualOut))
{
new Game().Run(reader, writer);
}

File.ReadAllLines(ActualOut).Should().Equal(File.ReadAllLines(ExpectedOut));
}

[Fact]
public void WalkthroughDieTest()
{
const string ActualOut = "walkthrough.die.actual.out";
const string ExpectedOut = "walkthrough.die.out";

using (StreamReader reader = new StreamReader("walkthrough.die.in"))
using (StreamWriter writer = new StreamWriter(ActualOut))
{
new Game().Run(reader, writer);
@@ -0,0 +1,3 @@
go east
go east
<< END OF GAME >>
@@ -0,0 +1,4 @@
You are in the main room. There is a doorway to the east.
There is a table here.
> You are in the auxiliary room. There is a doorway to the west. There is a cliff to the east.
> You fall off a cliff. Game over.
File renamed without changes.
@@ -2,7 +2,7 @@ You are in the main room. There is a doorway to the east.
There is a table here.
> You say, "Hello," to no one in particular. No one answers.
> Where do you want to GO?
> You are in the auxiliary room. There is a doorway to the west.
> You are in the auxiliary room. There is a doorway to the west. There is a cliff to the east.
> You say, "Hello," to no one in particular. No one answers.
> You are in the main room. There is a doorway to the east.
There is a table here.

0 comments on commit 98d5019

Please sign in to comment.
You can’t perform that action at this time.