Example #1
0
        public void AddRobot_ThrowException()
        {
            RobotManager rm = new RobotManager(10);

            rm.Add(robot);
            Assert.Throws <InvalidOperationException>(() => rm.Add(robot));
        }
Example #2
0
        public void Add_NotEnoughCapacity()
        {
            robotManager = new RobotManager(1);
            robotManager.Add(new Robot("Gosho", 5));

            Assert.That(() => robotManager.Add(new Robot("Pesho", 6)), Throws.InvalidOperationException);
        }
Example #3
0
 public void AddingSameRobot_ExceptionShouldBeThrown()
 {
     Assert.Throws <InvalidOperationException>(() =>
     {
         manager.Add(robot);
         manager.Add(robot);
     });
 }
Example #4
0
        public void WhenDataIsCorrectShouldWork()
        {
            RobotManager manager = new RobotManager(3);

            manager.Add(robot);
            manager.Add(new Robot("test2", 12));
            Assert.AreEqual(2, manager.Count);
        }
Example #5
0
        public void AddShouldThrowExceptionWhenARobotWithSameNameIsAdded()
        {
            RobotManager robotManager = new RobotManager(10);

            robotManager.Add(this.robot);

            Assert.Throws <InvalidOperationException>(() => robotManager.Add(new Robot(this.robot.Name, 50)));
        }
Example #6
0
        public void AddRobot_ExceptionCapacity()
        {
            RobotManager rm = new RobotManager(2);

            rm.Add(robot);
            rm.Add(new Robot("roro", 12));
            Assert.Throws <InvalidOperationException>(() => rm.Add(new Robot("kkk", 11)));
        }
Example #7
0
        public void CountShouldChangeWhenAddingOrRemovingRobots()
        {
            robotManager.Add(robot);
            Assert.AreEqual(1, robotManager.Count);

            robotManager.Remove(robot.Name);
            Assert.AreEqual(0, robotManager.Count);
        }
Example #8
0
 public void WhenRobotManagerIsAddedAgain_ShoudThrowException()
 {
     manager.Add(robot);
     Assert.Throws <InvalidOperationException>(() =>
     {
         manager.Add(robot);
     });
 }
Example #9
0
        public void AddShouldIncreaseCount()
        {
            robotManager = new RobotManager(2);
            robotManager.Add(robot);
            robotManager.Add(secondRobot);

            Assert.That(robotManager.Count, Is.EqualTo(2));
        }
Example #10
0
        public void AddShouldThrowExceptionWhenCapacityIsExceeded()
        {
            RobotManager robotManager = new RobotManager(1);

            robotManager.Add(this.robot);

            Assert
            .Throws <InvalidOperationException>(() => robotManager.Add(new Robot("Bobbie", 50)));
        }
Example #11
0
 public void AddingRobotOvarCapacity_ExceptionShouldBeThrown()
 {
     Assert.Throws <InvalidOperationException>(() =>
     {
         RobotManager robotManager = new RobotManager(1);
         robotManager.Add(robot);
         robotManager.Add(new Robot("New", 20));
     });
 }
Example #12
0
        public void TestingCounter()
        {
            RobotManager manager = new RobotManager(2);

            manager.Add(new Robot("eee", 200));
            manager.Add(new Robot("eeee", 2003));

            Assert.AreEqual(2, manager.Count);
        }
        public void AddMethodShouldThrowExceptionWhenTryToAddSame()
        {
            RobotManager manager = new RobotManager(2);


            manager.Add(this.robot);

            Assert.Throws <InvalidOperationException>(() => manager.Add(this.robot));
        }
Example #14
0
        public void ChargeRobot_Ok()
        {
            RobotManager rm = new RobotManager(50);

            rm.Add(robot);
            rm.Add(new Robot("k", 10));
            rm.Charge("name");
            Assert.That(robot.Battery, Is.EqualTo(100));
        }
Example #15
0
        public void WorkRobot_Ok()
        {
            RobotManager rm = new RobotManager(50);

            rm.Add(robot);
            rm.Add(new Robot("k", 10));
            rm.Work("name", "job", 10);
            Assert.That(robot.Battery, Is.EqualTo(90));
        }
Example #16
0
        public void TestingAdder_ShouldThrowExcCapacity()
        {
            RobotManager manager = new RobotManager(1);
            Robot        robot   = new Robot("er", 100);

            manager.Add(robot);

            Assert.Throws <InvalidOperationException>(() => manager.Add(new Robot("3123", 20)));
        }
Example #17
0
        public void AddRobotWithExistingNameShouldThrowException()
        {
            robotManager = new RobotManager(5);
            robotManager.Add(robot);

            Assert.Throws <InvalidOperationException>(() =>
            {
                robotManager.Add(robot);
            });
        }
Example #18
0
        public void ChargeRobot_Exception()
        {
            RobotManager rm = new RobotManager(50);

            rm.Add(robot);
            rm.Add(new Robot("k", 10));
            Robot robotRemove = new Robot("roro", 10);

            Assert.Throws <InvalidOperationException>(() => rm.Charge("roro"));
        }
Example #19
0
        public void WorkShouldDecreaseBattery()
        {
            robotManager = new RobotManager(2);
            robotManager.Add(robot);
            robotManager.Add(secondRobot);

            robotManager.Work(secondRobot.Name, "clean", 10);

            Assert.That(secondRobot.Battery, Is.EqualTo(30));
        }
Example #20
0
        public void RemoveShouldWorkCorrectly()
        {
            robotManager = new RobotManager(2);
            robotManager.Add(robot);
            robotManager.Add(secondRobot);

            robotManager.Remove(secondRobot.Name);

            Assert.That(robotManager.Count, Is.EqualTo(1));
        }
Example #21
0
        public void RobotManagerShouldThrowExceptionForInvalidCapacity()
        {
            var robot        = new Robot("Acho", 4);
            var robotManager = new RobotManager(1);

            robotManager.Add(robot);

            Assert.Throws <InvalidOperationException>(()
                                                      => robotManager.Add(new Robot("Acho", 5)));
        }
Example #22
0
        public void TestRemoveRobot()
        {
            RobotManager manager = new RobotManager(4);

            manager.Add(new Robot("Test1", 25));
            manager.Add(new Robot("Test2", 25));
            manager.Remove("Test2");

            Assert.AreEqual(1, manager.Count);
        }
Example #23
0
 public void ThrowExceptionIfRobotAlreadyExists()
 {
     Assert.Throws <InvalidOperationException>(() =>
     {
         RobotManager manager = new RobotManager(3);
         manager.Add(robot);
         Robot newRobot = new Robot("TestName", 10);
         manager.Add(newRobot);
     });
 }
        public void RobotManagerAddMethethodShouldThrowExceptionForInvalidCapacity()
        {
            var robot        = new Robot("Viktor", 80);
            var robotManager = new RobotManager(1);

            robotManager.Add(robot);


            Assert.Throws <InvalidOperationException>(() => robotManager.Add(robot));
        }
Example #25
0
        public void AddShouldThrowExceptionWhenReachesCapacity()
        {
            robotManager = new RobotManager(1);
            robotManager.Add(robot);

            Assert.Throws <InvalidOperationException>(() =>
            {
                robotManager.Add(robot);
            });
        }
        public void ShouldThrowWhenRobotWithSameNameAddedPreviously()
        {
            var robotManager = new RobotManager(3);
            var robot        = new Robot("asd", 312);

            robotManager.Add(robot);

            Assert
            .Throws <InvalidOperationException>(() => robotManager.Add(robot));
        }
        public void ShouldThrowWhenAddingWithNotEnoughCapacity()
        {
            var robotManager = new RobotManager(1);
            var robot        = new Robot("asd", 312);

            robotManager.Add(robot);

            Assert
            .Throws <InvalidOperationException>(() => robotManager.Add(robot));
        }
Example #28
0
        public void AddindRobotWithSameNameShouldThrowException()
        {
            var robot        = new Robot("Acho", 4);
            var robotManager = new RobotManager(100);

            robotManager.Add(robot);

            Assert.Throws <InvalidOperationException>(()
                                                      => robotManager.Add(new Robot("Acho", 5)));
        }
Example #29
0
        public void WorkRobot_ExceptionName()
        {
            RobotManager rm = new RobotManager(50);

            rm.Add(robot);
            rm.Add(new Robot("k", 10));
            Robot robotRemove = new Robot("roro", 10);

            Assert.Throws <InvalidOperationException>(() => rm.Work("roro", "job", 2));
        }
Example #30
0
        public void RemoveRobot_Ok()
        {
            RobotManager rm = new RobotManager(50);

            rm.Add(robot);
            rm.Add(new Robot("k", 10));
            Robot robotRemove = new Robot("roro", 10);

            rm.Remove("k");
            Assert.That(rm.Count, Is.EqualTo(1));
        }