public void Find_ReturnsCorrectDutyFromDatabase_Duty()
        {
            Duty newDuty1 = new Duty("fire the cannons");

            newDuty1.Save();
            Duty newDuty2 = new Duty("trim sails");

            newDuty2.Save();
            Duty foundDuty = Duty.Find(newDuty1.Id);

            Assert.AreEqual(newDuty1, foundDuty);
        }
        public void Save_SavesToDatabase_DutyList()
        {
            Duty testDuty = new Duty("swab the decks");

            testDuty.Save();
            List <Duty> result       = Duty.GetAll();
            List <Duty> testDutyList = new List <Duty> {
                testDuty
            };

            CollectionAssert.AreEqual(testDutyList, result);
        }
        public ActionResult Create(int employeeId, string dutyDescription)
        {
            Dictionary <string, object> model = new Dictionary <string, object>();
            Employee foundEmployee            = Employee.Find(employeeId);
            Duty     newDuty = new Duty(dutyDescription);

            newDuty.Save();
            foundEmployee.AddDuty(newDuty);
            List <Duty> employeeDutys = foundEmployee.Dutys;

            model.Add("dutys", employeeDutys);
            model.Add("employee", foundEmployee);
            return(View("Show", model));
        }
        public void GetAll_ReturnsDutys_DutyList()
        {
            string dutyDescription1 = "swab decks";
            string dutyDescription2 = "Walk the plank";
            Duty   newDuty1         = new Duty(dutyDescription1);

            newDuty1.Save();
            Duty newDuty2 = new Duty(dutyDescription2);

            newDuty2.Save();
            List <Duty> newDutyList = new List <Duty> {
                newDuty1, newDuty2
            };
            List <Duty> result = Duty.GetAll();

            CollectionAssert.AreEqual(newDutyList, result);
        }