Ejemplo n.º 1
0
        public string Sell(string robotName, string ownerName)
        {
            IRobot currRobot = IsExist(robotName);

            garage.Sell(robotName, ownerName);

            string result = currRobot.IsChipped == true ? $"{ownerName} bought robot with chip" : $"{ownerName} bought robot without chip";

            return(result);
        }
Ejemplo n.º 2
0
        public string Sell(string robotName, string ownerName)
        {
            IRobot robot = GetRobot(robotName);

            _garage.Sell(robotName, ownerName);

            if (robot.IsChipped)
            {
                return(string.Format(OutputMessages.SellChippedRobot, ownerName));
            }

            return(string.Format(OutputMessages.SellNotChippedRobot, ownerName));
        }
Ejemplo n.º 3
0
        public string Sell(string robotName, string ownerName)
        {
            garage.Sell(robotName, ownerName);
            var currentRobot = garage.Robots[robotName];

            if (currentRobot.IsChipped)
            {
                return($"{ownerName} bought robot with chip");
            }
            else
            {
                return($"{ownerName} bought robot without chip");
            }
        }
Ejemplo n.º 4
0
        public string Sell(string robotName, string ownerName)
        {
            RobotExist(robotName);
            IRobot robot = GetRobotByName(robotName);

            garage.Sell(robotName, ownerName);

            if (robot.IsChipped)
            {
                return($"{ownerName} bought robot with chip");
            }

            return($"{ownerName} bought robot without chip");
        }
Ejemplo n.º 5
0
        public string Sell(string robotName, string ownerName)
        {
            CheckIfRobotExist(robotName);

            IRobot robot = Garage.Robots.Values.FirstOrDefault(x => x.Name == robotName);

            Garage.Sell(robotName, ownerName);

            if (robot.IsChipped)
            {
                return($"{ownerName} bought robot with chip");
            }

            return($"{ownerName} bought robot without chip");
        }
Ejemplo n.º 6
0
        public string Sell(string robotName, string ownerName)
        {
            var currentRobot = this.garage.Robots.FirstOrDefault(x => x.Key == robotName).Value;



            garage.Sell(robotName, ownerName);


            if (currentRobot.IsChipped)
            {
                return($"{ownerName} bought robot with chip");
            }

            return($"{ownerName} bought robot without chip");
        }
Ejemplo n.º 7
0
        public string Sell(string robotName, string ownerName)
        {
            IRobot robot = GetRobotByName(robotName);

            garage.Sell(robotName, ownerName);

            string result = string.Empty;

            if (robot.IsChipped)
            {
                result = string.Format(OutputMessages.SellChippedRobot, ownerName);
            }
            else
            {
                result = string.Format(OutputMessages.SellNotChippedRobot, ownerName);
            }
            return(result);
        }
Ejemplo n.º 8
0
        public string Sell(string robotName, string ownerName)
        {
            if (!garage.Robots.ContainsKey(robotName))
            {
                throw new ArgumentException(String.Format(ExceptionMessages.InexistingRobot, robotName));
            }
            IRobot currRobot = garage.Robots[robotName];

            garage.Sell(robotName, ownerName);
            if (currRobot.IsChipped)
            {
                return(String.Format(OutputMessages.SellChippedRobot, ownerName));
            }
            else
            {
                return(String.Format(OutputMessages.SellNotChippedRobot, ownerName));
            }
        }
Ejemplo n.º 9
0
        public string Sell(string robotName, string ownerName)//check if robot exists
        {
            if (!this.garage.Robots.ContainsKey(robotName))
            {
                throw new ArgumentException(string.Format(ExceptionMessages.InexistingRobot, robotName));
            }
            IRobot currentRobot = this.garage.Robots.FirstOrDefault(r => r.Key == robotName).Value;

            garage.Sell(robotName, ownerName);

            if (currentRobot.IsChipped)
            {
                return(string.Format(OutputMessages.SellChippedRobot, ownerName));
            }
            else
            {
                return(string.Format(OutputMessages.SellNotChippedRobot, ownerName));
            }
        }
Ejemplo n.º 10
0
        public string Sell(string robotName, string ownerName)
        {
            if (this.CheckRobotExist(robotName))
            {
                return($"Robot {robotName} does not exist");
            }

            var robot = this.garage.Robots[robotName];

            garage.Sell(robotName, ownerName);

            if (robot.IsChipped)
            {
                return($"{ownerName} bought robot with chip");
            }
            else
            {
                return($"{ownerName} bought robot without chip");
            }
        }