public void should_return_null_given_invalid_ticket_when_pick() { Cabinet cabinet = new Cabinet(boxNumber); Ticket ticket = new Ticket(); Assert.IsNull(cabinet.Pick(ticket)); }
public void should_not_return_bag_given_invalid_ticket_when_pick() { Ticket ticket = new Ticket(); Cabinet cabinet = new Cabinet(50); Assert.IsNull(new Direct(cabinet).Pick(ticket)); }
public Ticket Store(Bag aBag, Ticket ticket) { if (!HasEmptyBox()) return null; _dicTicketBag.Add(ticket, aBag); return ticket; }
public Bag Pick(Ticket ticket) { if (!m_Box.ContainsKey(ticket)) return null; Bag returnBag = m_Box[ticket]; m_Box.Remove(ticket); m_RemainingEmptyBoxCount++; return returnBag; }
public void Should_Give_Correct_Information_When_Invalid_Ticket_Passed_To_Robot() { List<Cabinet> notEmptyCabinetList = new List<Cabinet> { new Cabinet(1) }; var robot = new Robot(notEmptyCabinetList); var invalidTicket = new Ticket(); robot.Pick(invalidTicket); }
public Bag Pick(Ticket ticket) { if (false == _dicTicketBag.ContainsKey(ticket)) return null; var bag = _dicTicketBag[ticket]; _dicTicketBag.Remove(ticket); return bag; }
public Bag Pick(Ticket ticket) { foreach (Cabinet cab in m_Cabintes) { Bag b = cab.Pick(ticket); if (b != null) return b; } return null; }
public Ticket Store(Bag bag) { if (_dictionary.Count >= _capacity) throw new NoAvailableBoxException(); var ticket = new Ticket(); _dictionary.Add(ticket, bag); return ticket; }
public Bag PickBag(Ticket ticket, bool isFromRobot) { foreach (var storable in _stoableList) { var bag = storable.PickBag(ticket, isFromRobot); if (bag != null) return bag; } return null; }
public Ticket Store( Bag bag ) { if ( IsFull() ) { return null; } Ticket ticket = new Ticket(); m_Box.Add(ticket,bag); m_RemainingEmptyBoxCount--; return ticket; }
public Ticket Store(Bag aBag) { if (!HasEmptyBox()) { throw new NoEmptyBoxException(); } var ticket = new Ticket(); _dicTicketBag.Add(ticket,aBag); return ticket; }
public Bag PickBag(Ticket ticket) { Bag bag = null; foreach (var cabinet in _lsCabinet) { bag = cabinet.PickBag(ticket,true); if (null != bag) break; } return bag; }
public Bag Pick(Ticket ticket) { foreach (var cabinet in cabinetList) { if (Ticket.IsValidateTicket(ticket, TicketCreater)) continue; var bag = cabinet.Pick(ticket); if (bag!=null) return bag; } return null; }
public Bag PickBag(Ticket ticket, bool isFromRobot) { if (ticket == null) throw new NonTicketException("Invalid Ticket"); if (!_dictionary.ContainsKey(ticket)) return null; if (ticket.IsFromRobat != isFromRobot) return null; var bag = _dictionary[ticket]; _dictionary.Remove(ticket); return bag; }
public Bag Pick(Ticket ticket) { Bag targetBag = null; foreach (var cabinet in m_Cabinets) { var bag = cabinet.Pick(ticket); if (bag != null) { targetBag = bag; break; } } if (targetBag == null) throw new InvalidTicketException("Invalid Ticket"); return targetBag; }
public Bag Pick(Ticket ticket) { return _cabinets.Select(cabinet => cabinet.Pick(ticket)).FirstOrDefault(bag => bag != null); }
public Bag Pick(Ticket ticket,string ticketCreater) { if (Ticket.IsValidateTicket(ticket, ticketCreater)) return null; return Pick(ticket); }
public void should_return_null_when_pick_given_fake_ticket() { var robot = new Robot(); var cabinet1 = new Cabinet(2); var cabinet2 = new Cabinet(2); robot.Add(cabinet1); robot.Add(cabinet2); var bag1 = new Bag(); var bag2 = new Bag(); var bag3 = new Bag(); var ticket1 = robot.Store(bag1); var ticket2 = robot.Store(bag2); var ticket3 = new Ticket(); Assert.IsNull(robot.Pick(ticket3)); }
public Bag PickBag(Ticket ticket, bool isFromRobot) { return PickBag(ticket); }
public Ticket Store(Bag aBag) { var ticket = new Ticket(); return Store(aBag,ticket); }
public Bag Pick(Ticket ticket) { throw new System.NotImplementedException(); }
public Bag Pick(Ticket ticket) { return null; }