Пример #1
0
 public void Ensure_that_you_cannot_wash_things_if_you_are_holding_non_washable_stuff()
 {
     Avatar avatar = new Avatar();
     BagOfHolding bag = new BagOfHolding();
     Fork fork = new Fork();
     avatar.PickUp(bag);
     avatar.PickUp(fork);
     avatar.StartWashing();
 }
Пример #2
0
 public void Ensure_that_you_can_wash_items_without_specifying_wash_event_handlers()
 {
     Avatar avatar = new Avatar();
     Fork fork1 = new Fork();
     Fork fork2 = new Fork();
     avatar.PickUp(fork1);
     avatar.PickUp(fork2);
     avatar.StartWashing();
 }
Пример #3
0
        public void Ensure_that_you_can_wash_multiple_items_at_once()
        {
            bool dirtRatingImprovedEventHandled = false;
            bool allItemsCleanEventHandled = false;

            Avatar avatar = new Avatar();
            avatar.NotifyWhenDirtRatingImproves += (sender, args) => { dirtRatingImprovedEventHandled = true; };
            avatar.NotifyWhenItemsAreTotallyClean += (sender, args) => { allItemsCleanEventHandled = true; };

            Fork fork1 = new Fork {PercentClean = 0};
            Fork fork2 = new Fork {PercentClean = 0};
            Fork fork3 = new Fork {PercentClean = 0};
            avatar.PickUp(fork1);
            avatar.PickUp(fork2);
            avatar.PickUp(fork3);
            avatar.StartWashing();

            Assert.IsTrue(dirtRatingImprovedEventHandled);
            Assert.IsTrue(allItemsCleanEventHandled);
        }