public void ShouldManagerManageOtherMangers() { var cabinet1 = new Cabinet(2); var manager1 = new Manager(new List<IStoreable> {cabinet1}); var manager = new Manager(new List<IStoreable> {manager1}); var storedBag = new Bag(); var ticket = manager.Store(storedBag); Assert.AreEqual(1, cabinet1.AvailableBoxes()); var pickedBag = manager.Pick(ticket); Assert.AreSame(storedBag, pickedBag); }
public void ShouldStoreBagWithDirectlyByCabinet() { var cabinet = new Cabinet(10); var manager = new Manager(new List<IStoreable> {cabinet}); var storedBag = new Bag(); var ticket = manager.Store(storedBag); Assert.AreEqual(9, cabinet.AvailableBoxes()); var pickedBag = manager.Pick(ticket); Assert.AreSame(storedBag, pickedBag); }
public void ShouldStoreBagByAnyRobot() { var cabinet = new Cabinet(10); var cabinets1 = new List<Cabinet> {cabinet}; var robot = new Robot(cabinets1, new SequentialSelector(cabinets1)); var manager = new Manager(new List<IStoreable> {robot}); var storedBag = new Bag(); var ticket = manager.Store(storedBag); Assert.AreEqual(9, cabinet.AvailableBoxes()); Assert.AreSame(storedBag, manager.Pick(ticket)); }