public void EditSchedule_RemovingOneAddingOneDay_ReturnsCorrectValue()
        {
            var worker = new Worker
            {
                ID = 1,
                PreferedDays = new Dictionary<DayOfWeek, Worker.Ranking>
                {
                    {DayOfWeek.Monday, Worker.Ranking.Yes},
                    {DayOfWeek.Wednesday, Worker.Ranking.Yes},
                    {DayOfWeek.Friday, Worker.Ranking.Yes}
                }
            };

            var daysToChange = new Dictionary<DayOfWeek, Worker.Ranking>
            {
                {DayOfWeek.Wednesday, Worker.Ranking.No},
                {DayOfWeek.Thursday, Worker.Ranking.Yes}
            };

            //can't work Wednesday, but can Thursday
            worker.EditSchedule(daysToChange);

            Assert.AreEqual((int)worker.PreferedDays[DayOfWeek.Wednesday], -1);
            Assert.AreEqual((int)worker.PreferedDays[DayOfWeek.Thursday], 1);
        }
 public void AddWorker_IdealConditions_CountIsOne()
 {
     Worker fakeWorker = new Worker();
     fakeWorker.Name = "Fake Worker";
     _scheduleBot.AddWorker(fakeWorker);
        Assert.IsTrue(_scheduleBot.GetWorkersCount() == 1);
 }
 public void RemoveWorker_IdealConditions_CountIsZero()
 {
     Worker fakeWorker = new Worker();
     fakeWorker.Name = "Worker to Use";
     _scheduleBot.AddWorker(fakeWorker);
     _scheduleBot.RemoveWorker(fakeWorker);
     Assert.IsTrue(_scheduleBot.GetWorkersCount() == 0);
 }
        public void GetSpecificWorkerByName_WorkerExsits_ReturnsWorker()
        {
            var worker = new Worker{Name = "workerToGet"};
            _scheduleBot.AddWorker(worker);
            var result = _scheduleBot.GetSpecificWorker(worker.Name).Name;

            StringAssert.AreEqualIgnoringCase(worker.Name, result);
        }
        public void GetSpecificWorker_WorkerExsits_ReturnsWorker()
        {
            int fakeWorkerId = 1;
            Worker fakeWorker = new Worker{ID = fakeWorkerId, Name = "worker to use"};
            _scheduleBot.AddWorker(fakeWorker);

            var worker = _scheduleBot.GetSpecificWorker(fakeWorkerId);
            Assert.IsNotNull(worker);
            StringAssert.AreEqualIgnoringCase("worker to use", worker.Name);
        }
        public void SetWorkerDayPrefrences_IdealConditions_DaysEqual3()
        {
            var worker = new Worker
            {
                ID = 1,
                PreferedDays = new Dictionary<DayOfWeek, Worker.Ranking>
                {
                    {DayOfWeek.Monday, Worker.Ranking.Yes},
                    {DayOfWeek.Wednesday, Worker.Ranking.Yes},
                    {DayOfWeek.Friday, Worker.Ranking.Yes}
                }
            };

            Assert.IsTrue(worker.PreferedDays.Count == 3);
            Assert.IsTrue(worker.PreferedDays.ContainsKey(DayOfWeek.Monday));
        }
        private static string Execute(string command)
        {
            var commandToExecute = command.ToUpper();

            if (commandToExecute.Equals("EXIT"))
            {
                WriteToConsole("goodbye");
                System.Threading.Thread.Sleep(500);
                Environment.Exit(0);
            }
            if (commandToExecute.StartsWith("ADD"))
            {
                var name = command.Split(' ')[1];

                {
                    var workerToAdd = new Worker
                    {
                        Name = name.ToString()
                    };

                    _scheduleBot.AddWorker(workerToAdd);
                }

                return string.Format("Added {0}.", name);
            }

            if (commandToExecute.Equals(("COUNT")))
            {
                return string.Format("Count: {0}", _scheduleBot.GetWorkersCount().ToString());
            }

            if (commandToExecute.Equals(("GET")))
            {
                //get each name
                //return each name
                string stringNames = null;
                foreach (var worker in _scheduleBot.GetWorkers())
                {
                    stringNames += (worker + " ");
                }

                return stringNames;
            }

            return string.Format("Executed the {0} Command", commandToExecute[0]);
        }
        public void EditSchedule_GoingFromThreeToTwoDays_ReturnsCorrectValue()
        {
            var worker = new Worker
            {
                ID = 1,
                PreferedDays = new Dictionary<DayOfWeek, Worker.Ranking>
                {
                    {DayOfWeek.Monday, Worker.Ranking.Yes},
                    {DayOfWeek.Wednesday, Worker.Ranking.Yes},
                    {DayOfWeek.Friday, Worker.Ranking.Yes}
                }
            };

            //can't work wednesday
            worker.EditSchedule(DayOfWeek.Wednesday, Worker.Ranking.No);

            Assert.AreEqual((int)worker.PreferedDays[DayOfWeek.Wednesday], -1);
        }
 public void RemoveWorker(Worker workerToUse)
 {
     scheduleBotList.Remove(workerToUse);
 }
 public void AddWorker(Worker fakeWorker)
 {
     scheduleBotList.Add(fakeWorker);
 }
        public void SetWorkerStatus_IdealConditions_ReturnsFullTimeStatus()
        {
            var worker = new Worker();
            worker.ID = 1;
            _scheduleBot.AddWorker(worker);
            _scheduleBot.SetWorkerStatus(1,"Full");

            var workerToVerify = _scheduleBot.GetSpecificWorker(1);
            StringAssert.AreEqualIgnoringCase(workerToVerify.Status,"full");
        }
 public void SetWorkerStatus_InvalidStatusType_ThrowsException()
 {
     var worker = new Worker{ID = 1};
     _scheduleBot.AddWorker(worker);
     Assert.Throws<Exception>(() => _scheduleBot.SetWorkerStatus(worker.ID, "fake type"));
 }
        public void SetWorkerStatus_IdealConditions_ReturnsParTimeStatus(string workersStatus, string statusToTest)
        {
            var worker = new Worker();
            worker.ID = 1;
            _scheduleBot.AddWorker(worker);
            _scheduleBot.SetWorkerStatus(1, workersStatus);

            Worker workerToVerify = _scheduleBot.GetSpecificWorker(1);
            StringAssert.AreEqualIgnoringCase(workerToVerify.Status, statusToTest);
        }