Ejemplo n.º 1
0
 public void WhenChargeNotExisting_ExeptionShouldBeThrownn()
 {
     Assert.Throws <InvalidOperationException>(() =>
     {
         manager.Charge("Nqma me");
     });
 }
Ejemplo n.º 2
0
 public void WhenChargeNotExisitng_ShouldThrowException()
 {
     Assert.Throws <InvalidOperationException>(() =>
     {
         robotManager.Charge("NotExisitng");
     });
 }
Ejemplo n.º 3
0
        public void RobotManager_Charge_Should_ThrowException_When_TryToChargeUnexistingRobot()
        {
            robotManager.Add(robot);
            var invalid = new Robot("Invalid", 1);

            Assert.Throws <InvalidOperationException>(() => robotManager.Charge(invalid.Name));
        }
Ejemplo n.º 4
0
 public void ChargeMethodWorkCorrectly()
 {
     robotManager.Add(robot);
     robotManager.Work(robot.Name, robot.Name, 1);
     robotManager.Charge(robot.Name);
     Assert.AreEqual(10, robot.Battery);
 }
Ejemplo n.º 5
0
        public void ChargeThrowsException_WhenRobotWithNoSuchNameIsGiven()
        {
            robotManager.Add(new Robot("Robot", 10));

            Assert.Throws <InvalidOperationException>
                (() => robotManager.Charge("NoSuchNameExists"));
        }
Ejemplo n.º 6
0
        public void TestIChargekMethodThrowsExceptionIfNotFound()
        {
            robotManager.Add(robot);

            Assert.Throws <InvalidOperationException>(
                () => robotManager.Charge("gfdgdf")
                //,$"Robot with the name {robot.Name} doesn't exist!"
                );
        }
Ejemplo n.º 7
0
        public void Charge_ChecksIfItWorksWithValidInput()
        {
            Robot robot = new Robot("Spencer", 40);

            robotManager.Add(robot);
            int bateryUsage = 5;

            robotManager.Work("Spencer", "Digging", bateryUsage);
            robotManager.Charge("Spencer");
            Assert.That(robot.Battery, Is.EqualTo(robot.MaximumBattery));
        }
Ejemplo n.º 8
0
        public void ChargeShouldThrowExceptionWhenRobotIsNotFound()
        {
            var robotManager = new RobotManager(10);

            Assert.Throws <InvalidOperationException>(()
                                                      => robotManager.Charge("TestName"));
        }
Ejemplo n.º 9
0
 public void WhenChargeRobotBattShuldGetmaximmu()
 {
     manager.Add(robot);
     manager.Work(robot.Name, "jov", 5);
     manager.Charge(robot.Name);
     Assert.AreEqual(robot.Battery, 10);
 }
Ejemplo n.º 10
0
        public void ChargeShouldThrowExceptionWhenRobotNotFound()
        {
            string       robotName    = "Bobbie";
            RobotManager robotManager = new RobotManager(1);

            robotManager.Add(this.robot);

            Assert.Throws <InvalidOperationException>(() => robotManager.Charge(robotName));
        }
Ejemplo n.º 11
0
        public void ChargeMethod_RobotManager_Check_ThrownInvalidOperationExceptionIfLowBattery()
        {
            int          capacity     = 1;
            RobotManager robotManager = new RobotManager(capacity);

            string name = "A";

            Assert.That(() => robotManager.Charge(name), Throws.InvalidOperationException.With.Message.EqualTo($"Robot with the name {name} doesn't exist!"));
        }
Ejemplo n.º 12
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));
        }
Ejemplo n.º 13
0
        public void ThrowExceptionIfRobotToChargeDoesNotExist()
        {
            Assert.Throws <InvalidOperationException>(() =>
            {
                RobotManager manager = new RobotManager(2);

                manager.Charge("NoName");
            });
        }
Ejemplo n.º 14
0
        public void ChargeShouldThrowExceptionForInvalidRobot()
        {
            var robot        = new Robot("Acho", 20);
            var robotManager = new RobotManager(1);

            robotManager.Add(robot);

            Assert.Throws <InvalidOperationException>(()
                                                      => robotManager.Charge("Ely"));
        }
Ejemplo n.º 15
0
        public void RobotManagerChargeShouldThrowInvalidOperationExceptionWhenRobotIsNull()
        {
            var rb        = new RobotManager(1);
            var robotname = "Ivan";

            Assert.Throws <InvalidOperationException>(() =>
            {
                rb.Charge(robotname);
            }, $"Robot with the name {robotname} doesn't exist!");
        }
Ejemplo n.º 16
0
        public void CheckWheterChargeThrowsExceptionIfRobotIsNull()
        {
            robot        = new Robot(name, maxBatery);
            robotManager = new RobotManager(capacity);

            Assert.Throws <InvalidOperationException>(() =>
            {
                robotManager.Charge("NaNi");
            });
        }
Ejemplo n.º 17
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"));
        }
Ejemplo n.º 18
0
        public void WhenExistingRobotCharges_ShoudChargeCorrectly()
        {
            RobotManager roboManager = new RobotManager(1);

            roboManager.Add(robot);
            roboManager.Work("Test", "raboti", 1);
            roboManager.Work("Test", "raboti", 1);
            roboManager.Charge("Test");
            Assert.AreEqual(robot.MaximumBattery, robot.Battery);
        }
Ejemplo n.º 19
0
        public void ChargeShouldIncreaseBatteryToItsMaximum()
        {
            RobotManager robotManager = new RobotManager(1);

            this.robot.Battery = 55;
            robotManager.Add(this.robot);

            robotManager.Charge(this.robot.Name);

            Assert.AreEqual(this.robot.MaximumBattery, this.robot.Battery);
        }
Ejemplo n.º 20
0
        public void WhenUnexistingRobotCharges_ShoudThrowException()
        {
            RobotManager roboManager = new RobotManager(1);

            roboManager.Add(robot);

            Assert.Throws <InvalidOperationException>(() =>
            {
                roboManager.Charge("ivan");
            });
        }
        public void Charge_Method_Should_Throw_An_Exception_If_The_Robot_Is_Null()
        {
            var robotManager = new RobotManager(1);
            var robot        = new Robot("Ivan", 100);

            robotManager.Add(robot);

            Assert.Throws <InvalidOperationException>(
                () => robotManager.Charge(null),
                "Robot is not null.");
        }
        public void ShouldChargeWhenRobotExists()
        {
            var robotManager = new RobotManager(1);
            var robot        = new Robot("d", 5);

            robotManager.Add(robot);
            robotManager.Work("d", "cleaning", 3);
            robotManager.Charge("d");

            Assert.AreEqual(5, robot.Battery);
        }
        public void ShouldThrowWhenChargingNonexistentRobot()
        {
            var robotManager = new RobotManager(1);
            var robot        = new Robot("d", 5);

            robotManager.Add(robot);
            robotManager.Work("d", "cleaning", 3);

            Assert
            .Throws <InvalidOperationException>(() => robotManager.Charge("x"));
        }
        public void Charge_Method_Should_Charge_The_Robot_Correctly()
        {
            var robotManager = new RobotManager(1);
            var robot        = new Robot("Ivan", 100);

            robotManager.Add(robot);
            robotManager.Work("Ivan", "Kravar", 80);
            robotManager.Charge("Ivan");

            Assert.That(robot.Battery, Is.EqualTo(100));
        }
Ejemplo n.º 25
0
        public void ChargeShouldThrowsExceptionWhenRobbotDoesntExist()
        {
            RobotManager robotManager = new RobotManager(10);

            string invalidName = "Pesho";

            Assert.Throws <InvalidOperationException>(() =>
            {
                robotManager.Charge(invalidName);
            }, $"Robot with the name {invalidName} doesn't exist!");
        }
Ejemplo n.º 26
0
        public void ChargeRobotWhitWork_Sccess()
        {
            RobotManager rm = new RobotManager(50);

            rm.Add(robot);
            rm.Work("name", "job", 5);
            rm.Charge("name");
            Assert.AreEqual(robot.Battery, 100);
            Assert.AreEqual(robot.Battery, robot.MaximumBattery);
            Assert.That(robot.Battery, Is.EqualTo(robot.MaximumBattery));
        }
Ejemplo n.º 27
0
        public void ChargeMethodShouldThrowExceptionIfRobotNameIsInvalid()
        {
            RobotManager robotManager = new RobotManager(1);

            robotManager.Add(testRobot1);

            Assert.Throws <InvalidOperationException>(() =>
            {
                robotManager.Charge("invalid name");
            });
        }
Ejemplo n.º 28
0
        public void ChargeShouldThrowExceptionWhenRobotsNotFound()
        {
            RobotManager robotManager = new RobotManager(1);

            robotManager.Add(this.robot);

            Assert.Throws <InvalidOperationException>(() =>
            {
                robotManager.Charge("Simkata");
            });
        }
Ejemplo n.º 29
0
        public void ChargeShouldThrowExceptionWhenNonexistingRobotName()
        {
            robotManager = new RobotManager(2);
            robotManager.Add(robot);
            robotManager.Add(secondRobot);

            Assert.Throws <InvalidOperationException>(() =>
            {
                robotManager.Charge("Opa");
            });
        }
Ejemplo n.º 30
0
        public void ChargeShouldSetToMaximum()
        {
            var robot        = new Robot("Acho", 20);
            var robotManager = new RobotManager(1);

            robotManager.Add(robot);
            robotManager.Work("Acho", "Cleaning", 15);
            robotManager.Charge("Acho");

            Assert.AreEqual(20, robot.Battery);
        }