Пример #1
0
        public void AddRobot_ThrowException()
        {
            RobotManager rm = new RobotManager(10);

            rm.Add(robot);
            Assert.Throws <InvalidOperationException>(() => rm.Add(robot));
        }
Пример #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);
        }
Пример #3
0
 public void AddingSameRobot_ExceptionShouldBeThrown()
 {
     Assert.Throws <InvalidOperationException>(() =>
     {
         manager.Add(robot);
         manager.Add(robot);
     });
 }
Пример #4
0
        public void WhenDataIsCorrectShouldWork()
        {
            RobotManager manager = new RobotManager(3);

            manager.Add(robot);
            manager.Add(new Robot("test2", 12));
            Assert.AreEqual(2, manager.Count);
        }
Пример #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)));
        }
Пример #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)));
        }
Пример #7
0
        public void CountShouldChangeWhenAddingOrRemovingRobots()
        {
            robotManager.Add(robot);
            Assert.AreEqual(1, robotManager.Count);

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

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

            robotManager.Add(this.robot);

            Assert
            .Throws <InvalidOperationException>(() => robotManager.Add(new Robot("Bobbie", 50)));
        }
Пример #11
0
 public void AddingRobotOvarCapacity_ExceptionShouldBeThrown()
 {
     Assert.Throws <InvalidOperationException>(() =>
     {
         RobotManager robotManager = new RobotManager(1);
         robotManager.Add(robot);
         robotManager.Add(new Robot("New", 20));
     });
 }
Пример #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);
        }
Пример #13
0
        public void AddMethodShouldThrowExceptionWhenTryToAddSame()
        {
            RobotManager manager = new RobotManager(2);


            manager.Add(this.robot);

            Assert.Throws <InvalidOperationException>(() => manager.Add(this.robot));
        }
Пример #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));
        }
Пример #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));
        }
Пример #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)));
        }
Пример #17
0
        public void AddRobotWithExistingNameShouldThrowException()
        {
            robotManager = new RobotManager(5);
            robotManager.Add(robot);

            Assert.Throws <InvalidOperationException>(() =>
            {
                robotManager.Add(robot);
            });
        }
Пример #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"));
        }
Пример #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));
        }
Пример #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));
        }
Пример #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)));
        }
Пример #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);
        }
Пример #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);
     });
 }
Пример #24
0
        public void RobotManagerAddMethethodShouldThrowExceptionForInvalidCapacity()
        {
            var robot        = new Robot("Viktor", 80);
            var robotManager = new RobotManager(1);

            robotManager.Add(robot);


            Assert.Throws <InvalidOperationException>(() => robotManager.Add(robot));
        }
Пример #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));
        }
Пример #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)));
        }
Пример #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));
        }
Пример #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));
        }