public void should_return_null_given_no_empty_box_when_store() { var cabinet = new Cabinet(boxNumber); for (var i = 0; i < boxNumber; i++) cabinet.Store(new Bag()); cabinet.Store(new Bag()); }
public void test_cabinetutil_can_return_cabinet_empty_rate() { const int capacity = 10; var cabinet = new Cabinet(capacity); cabinet.Store(new Bag()); cabinet.Store(new Bag()); Assert.AreEqual((10.0-2.0) / 10, CabinetUtil.EmptyRate(cabinet)); }
public void should_return_bag_given_valid_ticket_when_pick() { Bag aBag = new Bag(); Cabinet cabinet = new Cabinet(boxNumber); Ticket ticket = cabinet.Store(aBag); Assert.AreEqual(aBag, cabinet.Pick(ticket)); }
public void should_return_null_given_used_ticket_when_pick() { var cabinet = new Cabinet(boxNumber); Bag newbag = new Bag(); Ticket ticket = cabinet.Store(newbag); cabinet.Pick(ticket); Assert.IsNull(cabinet.Pick(ticket)); }
public void Store_One_Bag_When_Cabinet_Has_EmptyBox_Return_Valid_Ticket() { int nBox = 3; var cabinet = new Cabinet(nBox); var bag = new Bag(); var ticket = cabinet.Store(bag); Assert.IsNotNull(ticket); }
public void Store_One_Bag_When_Cabinet_Full_Return_Null_Ticket() { int nBox = 0; var cabinet = new Cabinet(nBox); var bag = new Bag(); var ticket = cabinet.Store(bag); Assert.IsNull(ticket); }
public void should_return_ticket_given_empty_cabinet_when_store() { Bag aBag = new Bag(); Cabinet cabinet = new Cabinet(boxNumber); Ticket ticket = cabinet.Store(aBag); Assert.IsNotNull(ticket); }
public void Pick_Return_NULL_When_Give_InValid_Ticket() { int nBox = 3; var cabinet = new Cabinet(nBox); var myBag = new Bag(); var ticket = cabinet.Store(myBag); cabinet.Pick(ticket); Assert.IsNull(cabinet.Pick(ticket)); }
public void test_robot_could_not_pick_bag_when_ticket_has_be_returned_by_cabinet() { var rb = new Robot(); var cabinet = new Cabinet(2); rb.Add(cabinet); var pickedBag = rb.PickBag(cabinet.Store(new Bag())); Assert.AreEqual(null, pickedBag); }
public void Pick_One_Bag_When_Cabinet_Has_My_Bag_And_Give_Valid_Ticket() { int nBox = 3; var cabinet = new Cabinet(nBox); var myBag = new Bag(); var ticket = cabinet.Store(myBag); Bag returnBag = cabinet.Pick(ticket); Assert.AreEqual(myBag, returnBag); }
public void test_superrobot_can_store_bag_by_emptyboxrate() { var superRobot = new SuperRobot(); var cabinet1 = new Cabinet(10); var cabinet2 = new Cabinet(8); cabinet1.Store(new Bag()); cabinet1.Store(new Bag()); cabinet1.Store(new Bag()); cabinet2.Store(new Bag()); cabinet2.Store(new Bag()); superRobot.Add(cabinet1); superRobot.Add(cabinet2); superRobot.Store(new Bag()); Assert.AreEqual(5, cabinet2.GetEmptyBoxCount()); }
public void should_return_validate_ticket_and_Save_to_MoreEmptyBoxRateCabinet_when_store_given_has_empty_box() { var superRobot = new SuperRobot(); var cabinet1 = new Cabinet(2); var cabinet2 = new Cabinet(1); superRobot.Add(cabinet1); superRobot.Add(cabinet2); var ticket1 = Ticket.CreateTicket("SuperRobot"); ticket1 = cabinet1.Store(new Bag(), ticket1); var ticket = superRobot.Store(new Bag()); Assert.IsNotNull(ticket); Assert.IsFalse(cabinet2.HasEmptyBox()); }
public void test_should_return_null_when_picking_bag_by_invalid_ticket() { var cabinet = new Cabinet(); cabinet.Store(new Bag()); var pickBag = cabinet.PickBag(new Ticket(),false); Assert.IsNull(pickBag); }
public void test_should_pick_desired_bag_by_ticket() { var cabinet = new Cabinet(); Bag bag1 = new Bag(); Bag bag2 = new Bag(); Ticket ticket1 = cabinet.Store(bag1); Ticket ticket2 = cabinet.Store(bag2); Assert.AreEqual(bag1, cabinet.PickBag(ticket1,false)); Assert.AreEqual(bag2, cabinet.PickBag(ticket2,false)); }
public void test_should_pick_bag_by_ticket() { var cabinet = new Cabinet(); Bag bag = new Bag(); Ticket ticket = cabinet.Store(bag); Assert.AreEqual(bag, cabinet.PickBag(ticket,false)); }
public void test_should_robot_save_bag_sequentially_when_nonrobot_save_bag_first() { var rb = new Robot(); var cabinet1 = new Cabinet(2); rb.Add(cabinet1); var cabinet2 = new Cabinet(2); rb.Add(cabinet2); cabinet1.Store(new Bag()); cabinet2.Store(new Bag()); rb.Store(new Bag()); Assert.IsFalse(cabinet1.HasEmptyBox()); }
public void test_pick_bag_by_obselete_ticket() { var cabinet = new Cabinet(); Ticket ticket = cabinet.Store(new Bag()); cabinet.PickBag(ticket,false); Assert.IsNull(cabinet.PickBag(ticket,false)); }
public void test_Has_empty_box_and_store_bag_and_get_a_ticket() { var cabinet = new Cabinet(); Ticket ticket = cabinet.Store(new Bag()); Assert.IsNotNull(ticket); }
public void test_should_throw_exception_when_cabinet_is_full() { const int capacity = 2; var cabinet = new Cabinet(capacity); cabinet.Store(new Bag()); cabinet.Store(new Bag()); cabinet.Store(new Bag()); }
public void test_should_throw_exception_when_picking_bag_by_non_ticket() { var cabinet = new Cabinet(); cabinet.Store(new Bag()); cabinet.PickBag(new object() as Ticket,false); }