public void should_not_return_ticket_given_full_cabinet_when_pick()
        {
            Bag bag = new Bag();
            var cabinet = new Cabinet(0);

            Assert.IsNull(new Direct(cabinet).Store(bag));
        }
 public void should_return_false_given_hasnot_empty_box()
 {
     var robot = new Robot();
     var cabinet = new Cabinet(0);
     robot.Add(cabinet);
     Assert.IsFalse(robot.HasEmptyBox());
 }
        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));
        }
Esempio n. 4
0
        public bool Add(Cabinet c1)
        {
            if (c1 == null) return false;

            _cabinets.Add(c1);
            return true;
        }
        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_return_false_given_hasnot_empty_box()
        {
            Cabinet cabinet = new Cabinet(0);
            var directInstance = new Direct(cabinet);

            Assert.IsFalse(directInstance.HasEmptyBox());
        }
Esempio n. 7
0
        public void test_can_get_capacity()
        {
            const int capacity = 2;
            var cabinet = new Cabinet(capacity);

            Assert.AreEqual(capacity, cabinet.GetCapacity());
        }
        public void should_return_true_given_has_empty_box()
        {
            Cabinet cabinet = new Cabinet(50);
            var directInstance = new Direct(cabinet);

            Assert.IsTrue(directInstance.HasEmptyBox());
        }
 public void Should_hold_cabinet()
 {
     var mgr = new Manager();
     var cabinet = new Cabinet(1);
     mgr.Add(cabinet);
     Assert.IsTrue(mgr.HasEmptyBox());
 }
Esempio n. 10
0
 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());
 }
Esempio n. 11
0
        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));
        }
Esempio n. 12
0
 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);
 }
Esempio n. 13
0
 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));
 }
Esempio n. 14
0
        public void test_smartrobot_get_empty_box_count()
        {
            var srb = new SmartRobot();
            var cabinet = new Cabinet(1);
            srb.Add(cabinet);

            Assert.AreEqual(1, cabinet.GetEmptyBoxCount());
        }
Esempio n. 15
0
        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);
        }
Esempio n. 16
0
 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_store_bag_when_has_empty_cabinet()
 {
     var mgr = new Manager();
     var cabinet = new Cabinet(1);
     var bag = new Bag();
     mgr.Add(cabinet);
     mgr.Store(bag);
     Assert.IsFalse(mgr.HasEmptyBox());
 }
        public void should_return_ticket_given_empty_cabinet_when_store()
        {
            Bag aBag = new Bag();
            Cabinet cabinet = new Cabinet(50);

            Ticket ticket = new Direct(cabinet).Store(aBag);

            Assert.IsNotNull(ticket);
        }
Esempio n. 19
0
        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));
        }
Esempio n. 20
0
 public void TestManagerCouldPickBoxStoredFromManagerGivenManagerStoreBoxIntoCabinet()
 {
     var manager = new Manager();
     var cabinet = new Cabinet();
     manager.Add(cabinet);
     var bag = new Bag();
     var ticket = manager.Store(bag, false);
     var returnBag = manager.PickBag(ticket, false);
     Assert.AreEqual(bag, returnBag);
 }
Esempio n. 21
0
 public void TestManagerCouldGetEmptyBoxCountGivenManagerStoreBoxIntoCabinet()
 {
     var manager = new Manager();
     var cabinet1 = new Cabinet(10);
     var cabinet2 = new Cabinet(10);
     manager.Add(cabinet1);
     manager.Add(cabinet2);
     manager.Store(new Bag(), false);
     Assert.AreEqual(19,manager.GetEmptyBoxCount());
 }
Esempio n. 22
0
        public void test_smartrobot_can_store_bag_by_order()
        {
            var srb = new SmartRobot();
            var cabinet = new Cabinet(3);
            srb.Add(cabinet);
            srb.Add(new Cabinet(1));
            srb.Store(new Bag());

            Assert.AreEqual(2, cabinet.GetEmptyBoxCount());
        }
Esempio n. 23
0
        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);
        }
Esempio n. 24
0
        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 should_not_return_bag_given_used_ticket_when_pick()
        {
            Bag aBag = new Bag();
            Cabinet cabinet = new Cabinet(50);
            var directInstance = new Direct(cabinet);
            Ticket ticket = directInstance.Store(aBag);
            directInstance.Pick(ticket);

            Assert.IsNull(directInstance.Pick(ticket));
        }
Esempio n. 26
0
        public void TestManagerCouldStoreBoxGivenManagerHasOneRobotAndOneCabinet()
        {
            var manager = new Manager();
            var robot = new Robot();
            var cabinet = new Cabinet();
            robot.Add(cabinet);
            manager.Add(robot);

            var ticket = manager.Store(new Bag(), true);
            Assert.IsNotNull(ticket);
        }
Esempio n. 27
0
        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);
        }
Esempio n. 28
0
        public void Return_Ticket_When_Seats_Available()
        {
            var oneseatcabinet = new Cabinet(1);
            var twoseatscabinet = new Cabinet(2);
            List<Cabinet> cabinets = new List<Cabinet> { oneseatcabinet, twoseatscabinet };
            var robot = new SmartRobot(cabinets);

            var ticket = robot.Store(new Bag());

            Assert.IsNotNull(ticket);
            Assert.IsFalse(oneseatcabinet.IsFull());
        }
Esempio n. 29
0
        public void should_not_store_bag_given_full_cabinet()
        {
            var robot = new Robot();
            var cabinet = new Cabinet(1);
            robot.Add(cabinet);
            var bagA = new Bag();
            robot.Store(bagA);

            var bagB = new Bag();
            var ticket = robot.Store(bagB);
            Assert.IsNull(ticket);
        }
        public void should_return_bag_given_valid_ticket_when_pick()
        {
            Bag aBag = new Bag();
            Bag anotherBag = new Bag();
            Cabinet cabinet = new Cabinet(50);

            var directInstance = new Direct(cabinet);
            Ticket ticket = directInstance.Store(aBag);
            var resultTicket = directInstance.Pick(ticket);

            Assert.AreEqual(aBag, resultTicket);
            Assert.AreNotEqual(anotherBag, resultTicket);
        }