public void AddTeacher_WhenIdIsInvalid_ShouldThrowArgumentOutOfRangeException()
        {
            var invalidID     = -1;
            var mockedTeacher = new Mock <ITeacher>();

            var ex = Assert.Throws <ArgumentOutOfRangeException>(() => SchoolSystemEngine.AddTeacher(invalidID, mockedTeacher.Object));

            StringAssert.Contains("cannot be less than 0!", ex.Message);
        }
        public void AddTeacher_WhenTeacherIsNull_ShouldThrowArgumentNullException()
        {
            var      id          = 100;
            ITeacher nullTeacher = null;

            var ex = Assert.Throws <ArgumentNullException>(() => SchoolSystemEngine.AddTeacher(id, nullTeacher));

            StringAssert.Contains("cannot be null or empty", ex.Message);
        }
        public void AddTeacher_ShouldAddTeacherToListOfTeachers()
        {
            var expectedId    = 10;
            var mockedTeacher = new Mock <ITeacher>();

            SchoolSystemEngine.AddTeacher(expectedId, mockedTeacher.Object);

            Assert.AreSame(SchoolSystemEngine.Teachers[expectedId], mockedTeacher.Object);
        }
        public void RemoveTeacher_ShouldRemoveAddedTeacherFromList()
        {
            var expectedId    = 11;
            var mockedTeacher = new Mock <ITeacher>();

            SchoolSystemEngine.AddTeacher(expectedId, mockedTeacher.Object);

            SchoolSystemEngine.RemoveTeacher(expectedId);

            Assert.IsFalse(SchoolSystemEngine.Teachers.ContainsKey(expectedId));
        }
        /// <summary>
        /// Executes the CreateTeacherCommand and returns the result.
        /// </summary>
        /// <param name="parameters">The Teacher parameters.</param>
        /// <returns>A string describing the new teacher.</returns>
        public string Execute(IList <string> parameters)
        {
            var firstName = parameters[0];
            var lastName  = parameters[1];
            var subject   = (Subject)int.Parse(parameters[2]);

            var teacherToAdd = new Teacher(firstName, lastName, subject);

            SchoolSystemEngine.AddTeacher(id, teacherToAdd);

            return($"A new teacher with name {teacherToAdd.FirstName} {teacherToAdd.LastName}, subject {teacherToAdd.Subject} and ID {id++} was created.");
        }