private void deactivateItemToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DeactivateItem di = new DeactivateItem();

            di.Owner = this;
            di.Show();
        }
        public void SetItemToActive()
        {
            // Arrange
            var fakePlayer = A.Fake <IAdventurePlayer>();
            var fakeGame   = A.Fake <IReadonlyAdventureGame>();

            var fakeLamp = A.Fake <IAdventureItem>();

            A.CallTo(() => fakeLamp.ItemId).Returns(Item.Lamp);
            A.CallTo(() => fakeLamp.Nouns).Returns(new List <string> {
                "lamp"
            });
            A.CallTo(() => fakeLamp.IsEndlessSupply).Returns(false);
            A.CallTo(() => fakeLamp.IsPortable).Returns(true);
            A.CallTo(() => fakeLamp.IsMatch("lamp")).Returns(true);
            fakeLamp.IsActive = true;

            // Act
            var action = new DeactivateItem(string.Empty);
            var result = action.Do(fakePlayer, fakeLamp);

            // Assert
            Assert.IsFalse(fakeLamp.IsActive);
            Assert.IsTrue(result);
        }
Esempio n. 3
0
 public void Handle(DeactivateItem message)
 {
     DeactivateItem(message.Item, true);
 }