Beispiel #1
0
        public void AddTeacher_WithValidTeacherAndCourse()
        {
            // Arrange:
            var model = new AddTeacherViewModel
            {
                SSN  = SSN_GUNNA,
                Type = TeacherType.MainTeacher
            };
            var prevCount = _teacherRegistrations.Count;
            // Note: the method uses test data defined in [TestInitialize]

            // Act:
            var dto = _service.AddTeacherToCourse(COURSEID_VEFT_20163, model);

            // Assert:

            // Check that the dto object is correctly populated:
            Assert.AreEqual(SSN_GUNNA, dto.SSN);
            Assert.AreEqual(NAME_GUNNA, dto.Name);

            // Ensure that a new entity object has been created:
            var currentCount = _teacherRegistrations.Count;

            Assert.AreEqual(prevCount + 1, currentCount);

            // Get access to the entity object and assert that
            // the properties have been set:
            var newEntity = _teacherRegistrations.Last();

            Assert.AreEqual(COURSEID_VEFT_20163, newEntity.CourseInstanceID);
            Assert.AreEqual(SSN_GUNNA, newEntity.SSN);
            Assert.AreEqual(TeacherType.MainTeacher, newEntity.Type);

            // Ensure that the Unit Of Work object has been instructed
            // to save the new entity object:
            Assert.IsTrue(_mockUnitOfWork.GetSaveCallCount() > 0);

//			Assert.HasBeenCalled(_mockUnitOfWork.Save);
//			spyOn(obj, "doStuff").andCallThrough();
//			expect(obj.doStuff).to.haveBeenCalled();
        }
Beispiel #2
0
        public void AddTeacher_WithValidTeacherAndCourse()
        {
            // Arrange:
            var model = new AddTeacherViewModel
            {
                SSN  = SSN_GUNNA,
                Type = TeacherType.MainTeacher
            };
            var prevCount = _teacherRegistrations.Count;

            // Act:
            var dto = _service.AddTeacherToCourse(COURSEID_VEFT_20163, model);

            // Assert:

            // Check that the dto object is correctly populated:
            Assert.Equals(SSN_GUNNA, dto.SSN);
            Assert.Equals(NAME_GUNNA, dto.Name);

            // Ensure that a new entity object has been created:
            var currentCount = _teacherRegistrations.Count;

            Assert.Equals(prevCount + 1, currentCount);

            // Get access to the entity object and assert that
            // the properties have been set:
            var newEntity = _teacherRegistrations.Last();

            Assert.Equals(COURSEID_VEFT_20163, newEntity.CourseInstanceID);
            Assert.Equals(SSN_GUNNA, newEntity.SSN);
            Assert.Equals(TeacherType.MainTeacher, newEntity.Type);

            // Ensure that the Unit Of Work object has been instructed
            // to save the new entity object:
            Assert.IsTrue(_mockUnitOfWork.GetSaveCallCount() > 0);
        }