Skip to content
Permalink
Browse files

InventoryRequestedMessage -> ShowInventoryMessage

  • Loading branch information...
bobbymcr committed Dec 15, 2018
1 parent e751e7a commit cb65670e8b948db0075210ef0678a9252259ff8c
@@ -18,7 +18,7 @@ public sealed class Inventory : IDisposable
public Inventory(MessageBus bus)
{
this.bus = bus;
this.show = bus.Subscribe<InventoryRequestedMessage>(m => this.Show());
this.show = bus.Subscribe<ShowInventoryMessage>(m => this.Show());
this.take = bus.Subscribe<TakeItemMessage>(m => this.Take(m.Verb, m.Noun, m.Item));
this.drop = bus.Subscribe<DropItemMessage>(m => this.Drop(m.Verb, m.Noun, m.Items));
this.look = bus.Subscribe<LookItemMessage>(m => this.Look(m.Noun));

This file was deleted.

@@ -79,7 +79,7 @@ protected void Output(string message)

protected void Inventory()
{
this.bus.Send(new InventoryRequestedMessage());
this.bus.Send(new ShowInventoryMessage());
}

protected void Look(Word noun)
@@ -0,0 +1,10 @@
// <copyright file="ShowInventoryMessage.cs" company="Brian Rogers">
// Copyright (c) Brian Rogers. All rights reserved.
// </copyright>

namespace Adventure
{
public sealed class ShowInventoryMessage
{
}
}
@@ -19,7 +19,7 @@ public void ShowInventoryEmpty()
bus.Subscribe<OutputMessage>(m => messages.Add(m.Text));
using (Inventory inv = new Inventory(bus))
{
bus.Send(new InventoryRequestedMessage());
bus.Send(new ShowInventoryMessage());

messages.Should().Equal("You are carrying:", "(nothing)");
}
@@ -34,7 +34,7 @@ public void ShowInventoryOneItem()
using (Inventory inv = new Inventory(bus))
{
inv.Add("key", new TestItem());
bus.Send(new InventoryRequestedMessage());
bus.Send(new ShowInventoryMessage());

messages.Should().Equal("You are carrying:", "a key");
}
@@ -50,7 +50,7 @@ public void ShowInventoryTwoItems()
{
inv.Add("key", new TestItem());
inv.Add("coin", new TestItem2());
bus.Send(new InventoryRequestedMessage());
bus.Send(new ShowInventoryMessage());

messages.Should().Equal("You are carrying:", "a key", "a coin");
}
@@ -68,7 +68,7 @@ public void ShowInventoryAfterDispose()
inv.Add("coin", new TestItem2());
}

bus.Send(new InventoryRequestedMessage());
bus.Send(new ShowInventoryMessage());

messages.Should().BeEmpty();
}
@@ -174,7 +174,7 @@ public void DropAllowedItem()
{
inv.Add("key", new TestItem());
bus.Send(new DropItemMessage(items, new Word("drop", "THROW"), new Word("key", "KEY")));
bus.Send(new InventoryRequestedMessage());
bus.Send(new ShowInventoryMessage());

messages.Should().Equal("You THROW the KEY.", "You are carrying:", "(nothing)");
items.Look("{0}").Should().Be(1);
@@ -192,7 +192,7 @@ public void DropDisallowedItem()
{
inv.Add("key", new TestItem(false));
bus.Send(new DropItemMessage(items, new Word("drop", "THROW"), new Word("key", "KEY")));
bus.Send(new InventoryRequestedMessage());
bus.Send(new ShowInventoryMessage());

messages.Should().Equal("I won't let you drop this!", "You are carrying:", "a key");
items.Look("{0}").Should().Be(0);
@@ -242,7 +242,7 @@ public void TakeItem()
using (Inventory inv = new Inventory(bus))
{
bus.Send(new TakeItemMessage(new Word("take", "GRAB"), new Word("key", "KEY"), new TestItem()));
bus.Send(new InventoryRequestedMessage());
bus.Send(new ShowInventoryMessage());

messages.Should().Equal("You GRAB the KEY.", "You are carrying:", "a key");
}
@@ -425,7 +425,7 @@ public void RequestInventory()
{
MessageBus bus = new MessageBus();
int inv = 0;
bus.Subscribe<InventoryRequestedMessage>(_ => ++inv);
bus.Subscribe<ShowInventoryMessage>(_ => ++inv);
TestRoom room = new TestRoom(bus);

room.Enter();

0 comments on commit cb65670

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