Skip to content
Permalink
Browse files

Room - Drop -> Add

  • Loading branch information...
bobbymcr committed Dec 14, 2018
1 parent c27ff5c commit 0cb38facad87381c0a704d7c5e8ed1467e3b3b63
Showing with 20 additions and 20 deletions.
  1. +2 −2 core/src/Room.cs
  2. +16 −16 core/test/RoomTest.cs
  3. +1 −1 sample/src/MainRoom.cs
  4. +1 −1 sample/src/Table.cs
@@ -50,7 +50,7 @@ public void Leave()
this.sub = null;
}

public void Drop(string name, Item item)
public void Add(string name, Item item)
{
this.items.Drop(name, item);
}
@@ -124,7 +124,7 @@ private void TakeItem(Word verb, Word noun)

if (!taken.Take(this.bus))
{
this.Drop(noun.Primary, taken);
this.Add(noun.Primary, taken);
return;
}

@@ -160,7 +160,7 @@ public void ProcessLookItem()
Action<OutputMessage> subscriber = m => lastOutput = m.Text;
bus.Subscribe(subscriber);
Room room = new TestRoom(bus);
room.Drop("key", new TestKey());
room.Add("key", new TestKey());

room.Enter();
bus.Send(new SentenceMessage(new Word("look", "LOOK"), new Word("key", "KEY")));
@@ -191,8 +191,8 @@ public void ProcessTakeAvailableItem()
});
TestRoom room = new TestRoom(bus);
Item expectedItem = new TestKey();
room.Drop("key", expectedItem);
room.Drop("coin", new TestCoin());
room.Add("key", expectedItem);
room.Add("coin", new TestCoin());

room.Enter();
bus.Send(new SentenceMessage(new Word("take", "TAKE"), new Word("key", "KEY")));
@@ -221,8 +221,8 @@ public void ProcessTakeUnavailableItem()
actualItem = m.Item;
});
TestRoom room = new TestRoom(bus);
room.Drop("key", new TestKey(false));
room.Drop("coin", new TestCoin());
room.Add("key", new TestKey(false));
room.Add("coin", new TestCoin());

room.Enter();
bus.Send(new SentenceMessage(new Word("take", "TAKE"), new Word("key", "KEY")));
@@ -267,14 +267,14 @@ public void ProcessUnknownVerb()
}

[Fact]
public void DropOneItem()
public void AddOneItem()
{
MessageBus bus = new MessageBus();
List<string> output = new List<string>();
Action<OutputMessage> subscriber = m => output.Add(m.Text);
bus.Subscribe(subscriber);
TestRoom room = new TestRoom(bus);
room.Drop("key", new TestKey());
room.Add("key", new TestKey());

room.Enter();

@@ -284,15 +284,15 @@ public void DropOneItem()
}

[Fact]
public void DropTwoItems()
public void AddTwoItems()
{
MessageBus bus = new MessageBus();
List<string> output = new List<string>();
Action<OutputMessage> subscriber = m => output.Add(m.Text);
bus.Subscribe(subscriber);
TestRoom room = new TestRoom(bus);
room.Drop("key", new TestKey());
room.Drop("coin", new TestCoin());
room.Add("key", new TestKey());
room.Add("coin", new TestCoin());

room.Enter();

@@ -310,8 +310,8 @@ public void ProcessCustomItemAction()
Action<OutputMessage> subscriber = m => lastOutput = m.Text;
bus.Subscribe(subscriber);
TestRoom room = new TestRoom(bus);
room.Drop("key", new TestKey());
room.Drop("coin", new TestCoin());
room.Add("key", new TestKey());
room.Add("coin", new TestCoin());

room.Enter();
bus.Send(new SentenceMessage(new Word("flip", "FLIP"), new Word("coin", "COIN")));
@@ -327,8 +327,8 @@ public void ProcessCustomItemActionAfterLeave()
Action<OutputMessage> subscriber = m => lastOutput = m.Text;
bus.Subscribe(subscriber);
TestRoom room = new TestRoom(bus);
room.Drop("key", new TestKey());
room.Drop("coin", new TestCoin());
room.Add("key", new TestKey());
room.Add("coin", new TestCoin());

room.Enter();
room.Leave();
@@ -345,8 +345,8 @@ public void ProcessUnknownCustomItemAction()
Action<OutputMessage> subscriber = m => lastOutput = m.Text;
bus.Subscribe(subscriber);
TestRoom room = new TestRoom(bus);
room.Drop("key", new TestKey());
room.Drop("coin", new TestCoin());
room.Add("key", new TestKey());
room.Add("coin", new TestCoin());

room.Enter();
bus.Send(new SentenceMessage(new Word("flip", "FLIP"), new Word("key", "KEY")));
@@ -9,7 +9,7 @@ internal sealed class MainRoom : Room
public MainRoom(MessageBus bus)
: base(bus)
{
this.Drop(Noun.Table, new Table(this));
this.Add(Noun.Table, new Table(this));
}

protected override string Description => "You are in the main room.";
@@ -42,7 +42,7 @@ private void Move(MessageBus bus)
{
this.tableMoved = true;
bus.Send(new OutputMessage("You move the table slightly. Underneath you see a coin."));
this.parent.Drop(Noun.Coin, new Coin());
this.parent.Add(Noun.Coin, new Coin());
}
else
{

0 comments on commit 0cb38fa

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