Exemplo n.º 1
0
 public void Store_One_Bag_When_Not_All_Cabinets_Full_Return_Ticket()
 {
     var robot = new Robot(new List<Cabinet> { new Cabinet(0), new Cabinet(1), new Cabinet(0) });
     var bag = new Bag();
     var ticket = robot.Store(bag);
     Assert.IsNotNull(ticket);
 }
Exemplo n.º 2
0
 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());
 }
Exemplo n.º 3
0
 public void Store_One_Bag_When_All_Cabinets_Full_Return_Null_Ticket()
 {
     List<Cabinet> emptyCabinetList = new List<Cabinet> { new Cabinet(0) };
     var robot = new Robot(emptyCabinetList);
     var bag = new Bag();
     var ticket = robot.Store(bag);
     Assert.IsNull(ticket);
 }
Exemplo n.º 4
0
 public void Pick_One_Bag_When_Cabinet_Has_My_Bag_And_Give_Valid_Ticket()
 {
     var robot = new Robot(new List<Cabinet> { new Cabinet(0), new Cabinet(1), new Cabinet(0) });
     var bag = new Bag();
     var ticket = robot.Store(bag);
     Bag pickBag = robot.Pick(ticket);
     Assert.AreEqual(bag,pickBag);
 }
Exemplo n.º 5
0
        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 void Should_hold_Robet()
 {
     var mgr = new Manager();
     var robot=new Robot();
     var cabinet = new Cabinet(1);
     robot.Add(cabinet);
     mgr.Add(robot);
     Assert.IsTrue(mgr.HasEmptyBox());
 }
Exemplo n.º 7
0
 public void Pick_One_Bag_When_Cabinet_Has_My_Bag_And_Give_InValid_Ticket()
 {
     var robot = new Robot(new List<Cabinet> { new Cabinet(0), new Cabinet(1), new Cabinet(0) });
     var bag = new Bag();
     var ticket = robot.Store(bag);
     robot.Pick(ticket);
     Bag returnBag = robot.Pick(ticket);
     Assert.IsNull(returnBag);
 }
Exemplo n.º 8
0
 public void Store_One_Bag_When_Not_All_Cabinets_Full_Return_Ticket()
 {
     var robot = new Robot();
     List<int> emptyCaibet = new List<int> { 0, 1, 0 };
     robot.Setup(emptyCaibet);
     var bag = new Bag();
     var ticket = robot.Store(bag);
     Assert.IsNotNull(ticket);
 }
Exemplo n.º 9
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);
        }
Exemplo n.º 10
0
        public void Store_One_Bag_Return_Correct_Ticket_When_Not_All_Cabinets_Full()
        {
            List<Cabinet> notEmptyCabinetList = new List<Cabinet> { new Cabinet(1) };

            var robot = new Robot(notEmptyCabinetList);

            var bag = new Bag();
            var ticket = robot.Store(bag);
            var returnBag = robot.Pick(ticket);
            Assert.AreEqual(bag, returnBag);
        }
Exemplo n.º 11
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);
        }
Exemplo n.º 12
0
        public void test_robot_could_not_pick_bag_when_ticket_is_already_used()
        {
            var rb = new Robot();
            rb.Add(new Cabinet(2));
            var ticket = rb.Store(new Bag());
            rb.PickBag(ticket);

            var pickedBag = rb.PickBag(ticket);

            Assert.AreEqual(null, pickedBag);
        }
Exemplo n.º 13
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);
        }
Exemplo n.º 14
0
        public void should_return_matched_bag_when_pick_given_valid_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 = robot.Store(bag3);

            Assert.AreEqual(bag3, robot.Pick(ticket3));
        }
Exemplo n.º 15
0
        public void test_robot_could_pick_bag_when_ticket_is_valid()
        {
            var rb = new Robot();
            var cabinet = new Cabinet(2);
            rb.Add(cabinet);
            var bag = new Bag();
            var ticket = rb.Store(bag);

            var pickedBag = rb.PickBag(ticket);

            Assert.AreEqual(bag, pickedBag);
        }
Exemplo n.º 16
0
        public void TestManagerShouldHaveEmptyBoxGivenManagerHasOneRobotAndOneCabinet()
        {
            var manager = new Manager();
            var robot = new Robot();
            var cabinet = new Cabinet();
            robot.Add(cabinet);
            manager.Add(robot);

            Assert.IsTrue(manager.HasEmptyBox());
        }
Exemplo n.º 17
0
 public void should_return_false_given_null_cabinet_when_add_cabinet()
 {
     var robot = new Robot();
     Assert.IsFalse(robot.Add(null));
 }
Exemplo n.º 18
0
 public void should_return_false_given_null_cabinet_when_check_availability()
 {
     var robot = new Robot();
     Assert.IsFalse( robot.HasEmptyBox());
 }
Exemplo n.º 19
0
 public void should_return_true_given_cabinet_when_add_cabinet()
 {
     var robot = new Robot();
     var c1 = new Cabinet(2);
     Assert.IsTrue(robot.Add(c1));
 }
Exemplo n.º 20
0
 public void should_return_true_given_robot_with_empty_cabinet_when_check_availability()
 {
     var robot = new Robot();
     robot.Add(new Cabinet(50));
     Assert.IsTrue(robot.HasEmptyBox());
 }
Exemplo n.º 21
0
        public void test_should_robot_save_bag_when_has_empty_box()
        {
            var rb = new Robot();
            rb.Add(new Cabinet());
            rb.Add(new Cabinet());

            Assert.IsTrue(rb.HasEmptyBox());

            var t1 = rb.Store(new Bag());
            Assert.IsNotNull(t1);
        }
Exemplo n.º 22
0
        public void should_return_validate_ticket_when_store_given_has_empty_box()
        {
            var robot = new Robot();
            var cabinet = new Cabinet(50);
            robot.Add(cabinet);

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

            Assert.IsNotNull(ticket);
        }
Exemplo n.º 23
0
        public void should_return_null_when_store_given_has_not_empty_box()
        {
            var robotWithNoEmptyBox = new Robot();

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

            Assert.IsNull(ticket);
        }
Exemplo n.º 24
0
        public void should_store_bags_sequentially_given_bags()
        {
            var bag1 = new Bag();
            var bag2 = new Bag();
            var cabinet1 = new Cabinet(1);
            var cabinet2 = new Cabinet(1);
            var robot = new Robot();
            robot.Add(cabinet1);
            robot.Add(cabinet2);
            robot.Store(bag1);

            Assert.IsFalse(cabinet1.HasEmptyBox());
            Assert.IsTrue(cabinet2.HasEmptyBox());

            robot.Store(bag2);
            Assert.IsFalse(cabinet1.HasEmptyBox());
            Assert.IsFalse(cabinet2.HasEmptyBox());
        }
Exemplo n.º 25
0
 public void should_return_true_given_has_empty_box()
 {
     var robot = new Robot();
     var cabinet = new Cabinet(50);
     robot.Add(cabinet);
     Assert.IsTrue(robot.HasEmptyBox());
 }
Exemplo n.º 26
0
 public void test_should_not_robot_save_bag_when_all_cabinet_full()
 {
     var rb = new Robot();
     rb.Add(new Cabinet(1));
     rb.Store(new Bag());
     rb.Store(new Bag());
 }
Exemplo n.º 27
0
        public void test_should_robot_return_empty_box_when_has_empty_box()
        {
            var rb = new Robot();
            rb.Add(new Cabinet());
            rb.Add(new Cabinet());

            Assert.IsTrue(rb.HasEmptyBox());
        }
Exemplo n.º 28
0
 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());
 }
Exemplo n.º 29
0
        public void should_return_null_when_pick_given_cabinet_stroed_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();

            robot.Store(bag1);
            robot.Store(bag2);
            var ticket3 = new Direct(cabinet2).Store(bag3);

            Assert.IsNull(robot.Pick(ticket3));
        }
Exemplo n.º 30
0
        private static Robot SetupTwoCabinetRobot(int capacity1, int capacity2)
        {
            var robot = new Robot();
            robot.Add(new Cabinet(capacity1));
            robot.Add(new Cabinet(capacity2));

            return robot;
        }