Exemplo n.º 1
0
 public void Setup()
 {
     _mockUow     = new MockUnitOfWork <MockDataContext>();
     _mockFactory = new MockFactory();
     _mockUow.SetRepositoryData(_mockFactory.GetMockData <Student>());
     _mockUow.SetRepositoryData(_mockFactory.GetMockData <Course>());
     _mockUow.SetRepositoryData(_mockFactory.GetMockData <Enrollment>());
     _mockUow.SetRepositoryData(_mockFactory.GetMockData <Grade>());
     _service = new StudentService(_mockUow);
 }
        public void Setup()
        {
            // TODO: code which will be executed before each test!

            _mockUnitOfWork = new MockUnitOfWork <MockDataContext>();
            _dataFactory    = new MockDataFactory();

            // Setting up mock repos to be used
            _mockUnitOfWork.SetRepositoryData(_dataFactory.GetMockRepo <Person>());

            // Creating the service using the new mock UOW
            _service = new StudentsServiceProvider(_mockUnitOfWork);
        }
        public void GetCoursesBySemester_ReturnsEmptyListWhenNoDataDefined()
        {
            // Arrange:
            var emptyList = new List <CourseInstance> {
            };

            _mockUnitOfWork.SetRepositoryData(emptyList);

            // Act:
            var obj = _service.GetCourseInstancesBySemester();

            // Assert:
            Assert.Equal(obj.Count, 0);
        }
Exemplo n.º 4
0
        public void Setup()
        {
            // TODO: code which will be executed before each test!

            _mockUnitOfWork = new MockUnitOfWork <MockDataContext>();
            _dataFactory    = new MockDataFactory();

            // Setting up mock repos to be used
            _mockUnitOfWork.SetRepositoryData(_dataFactory.GetMockRepo <Person>());
            _mockUnitOfWork.SetRepositoryData(_dataFactory.GetMockRepo <CourseTemplate>());
            _mockUnitOfWork.SetRepositoryData(_dataFactory.GetMockRepo <CourseInstance>());
            _mockUnitOfWork.SetRepositoryData(_dataFactory.GetMockRepo <AssignmentGroup>());
            _mockUnitOfWork.SetRepositoryData(_dataFactory.GetMockRepo <Assignment>());
            _mockUnitOfWork.SetRepositoryData(_dataFactory.GetMockRepo <Grade>());

            _mockUnitOfWork.SetRepositoryData(_dataFactory.GetMockRepo <StudentRegistration>());
            _mockUnitOfWork.SetRepositoryData(_dataFactory.GetMockRepo <CourseRequirement>());

            // Creating the service using the new mock UOW
            _service = new AssignmentServiceProvider(_mockUnitOfWork);
        }
        public void CourseServicesTestsSetup()
        {
            _mockUnitOfWork = new MockUnitOfWork <MockDataContext>();

            #region Persons
            var persons = new List <Person>
            {
                // Of course I'm the first person,
                // did you expect anything else?
                new Person
                {
                    ID    = 1,
                    Name  = "Daníel B. Sigurgeirsson",
                    SSN   = SSN_DABS,
                    Email = "*****@*****.**"
                },
                new Person
                {
                    ID    = 2,
                    Name  = NAME_GUNNA,
                    SSN   = SSN_GUNNA,
                    Email = "*****@*****.**"
                }
            };
            #endregion

            #region Course templates

            var courseTemplates = new List <CourseTemplate>
            {
                new CourseTemplate
                {
                    CourseID    = "T-514-VEFT",
                    Description = "Í þessum áfanga verður fjallað um vefþj...",
                    Name        = "Vefþjónustur"
                }
            };
            #endregion

            #region Courses
            var courses = new List <CourseInstance>
            {
                new CourseInstance
                {
                    ID         = COURSEID_VEFT_20153,
                    CourseID   = "T-514-VEFT",
                    SemesterID = "20153"
                },
                new CourseInstance
                {
                    ID         = COURSEID_VEFT_20163,
                    CourseID   = "T-514-VEFT",
                    SemesterID = "20163"
                }
            };
            #endregion

            #region Teacher registrations
            _teacherRegistrations = new List <TeacherRegistration>
            {
                new TeacherRegistration
                {
                    ID = 101,
                    CourseInstanceID = COURSEID_VEFT_20153,
                    SSN  = SSN_DABS,
                    Type = TeacherType.MainTeacher
                }
            };
            #endregion

            _mockUnitOfWork.SetRepositoryData(persons);
            _mockUnitOfWork.SetRepositoryData(courseTemplates);
            _mockUnitOfWork.SetRepositoryData(courses);
            _mockUnitOfWork.SetRepositoryData(_teacherRegistrations);

            // TODO: this would be the correct place to add
            // more mock data to the mockUnitOfWork!

            _service = new CoursesServiceProvider(_mockUnitOfWork);
        }
Exemplo n.º 6
0
        public CourseServicesTests()
        {
            _mockUnitOfWork = new MockUnitOfWork <MockDataContext>();

            #region Persons
            var persons = new List <Person> {
                // Of course I'm the first person,
                // did you expect anything else?
                new Person {
                    ID    = 1,
                    Name  = NAME_DABS,
                    SSN   = SSN_DABS,
                    Email = "*****@*****.**"
                },
                new Person {
                    ID    = 2,
                    Name  = NAME_GUNNA,
                    SSN   = SSN_GUNNA,
                    Email = "*****@*****.**"
                },
                new Person {
                    ID    = 3,
                    Name  = NAME_DAVID,
                    SSN   = SSN_DAVID,
                    Email = "*****@*****.**"
                },
                new Person {
                    ID    = 4,
                    Name  = NAME_DARRI,
                    SSN   = SSN_DARRI,
                    Email = "*****@*****.**"
                }
            };
            #endregion

            #region Course templates

            var courseTemplates = new List <CourseTemplate> {
                new CourseTemplate {
                    CourseID    = VEFT_TEMPLATE_ID,
                    Description = "Í þessum áfanga verður fjallað um vefþj...",
                    Name        = VEFT_TEMPLATE_NAME
                },
                new CourseTemplate {
                    CourseID    = PROG_TEMPLATE_ID,
                    Description = "Í þessum áfanga verður forritad slatta...",
                    Name        = PROG_TEMPLATE_NAME
                },
                new CourseTemplate {
                    CourseID    = GAGN_TEMPLATE_ID,
                    Description = "Í þessum áfanga verður forritad i drasl...",
                    Name        = GAGN_TEMPLATE_NAME
                }
            };
            #endregion

            #region Courses
            var courses = new List <CourseInstance> {
                new CourseInstance {
                    ID         = COURSEID_VEFT_20153,
                    CourseID   = VEFT_TEMPLATE_ID,
                    SemesterID = "20153"
                },
                new CourseInstance {
                    ID         = COURSEID_VEFT_20163,
                    CourseID   = VEFT_TEMPLATE_ID,
                    SemesterID = "20163"
                },
                new CourseInstance {
                    ID         = COURSEID_GAGN_20153,
                    CourseID   = GAGN_TEMPLATE_ID,
                    SemesterID = "20153"
                },
                new CourseInstance {
                    ID         = COURSEID_GAGN_20163,
                    CourseID   = GAGN_TEMPLATE_ID,
                    SemesterID = "20163"
                },
                new CourseInstance {
                    ID         = COURSEID_PROG_20143,
                    CourseID   = PROG_TEMPLATE_ID,
                    SemesterID = "20143"
                },
                new CourseInstance {
                    ID         = COURSEID_PROG_20163,
                    CourseID   = PROG_TEMPLATE_ID,
                    SemesterID = "20163"
                }
            };
            #endregion

            #region Teacher registrations
            _teacherRegistrations = new List <TeacherRegistration> {
                new TeacherRegistration {
                    ID = 101,
                    CourseInstanceID = COURSEID_VEFT_20153,
                    SSN  = SSN_DABS,
                    Type = TeacherType.MainTeacher
                },
                new TeacherRegistration {
                    ID = 102,
                    CourseInstanceID = COURSEID_PROG_20163,
                    SSN  = SSN_DARRI,
                    Type = TeacherType.AssistantTeacher
                },
                new TeacherRegistration {
                    ID = 103,
                    CourseInstanceID = COURSEID_PROG_20163,
                    SSN  = SSN_DAVID,
                    Type = TeacherType.AssistantTeacher
                },
                new TeacherRegistration {
                    ID = 104,
                    CourseInstanceID = COURSEID_PROG_20143,
                    SSN  = SSN_DAVID,
                    Type = TeacherType.MainTeacher
                },
                new TeacherRegistration {
                    ID = 105,
                    CourseInstanceID = COURSEID_GAGN_20163,
                    SSN  = SSN_DARRI,
                    Type = TeacherType.MainTeacher
                }
            };
            #endregion

            _mockUnitOfWork.SetRepositoryData(persons);
            _mockUnitOfWork.SetRepositoryData(courseTemplates);
            _mockUnitOfWork.SetRepositoryData(courses);
            _mockUnitOfWork.SetRepositoryData(_teacherRegistrations);

            _service = new CoursesServiceProvider(_mockUnitOfWork);
        }
Exemplo n.º 7
0
        public void Setup()
        {
            _mockUnitOfWork = new MockUnitOfWork<MockDataContext>();

            #region Persons
            var persons = new List<Person>
            {
                new Person
                {
                    ID    = 1,
                    Name  = NAME_DABS,
                    SSN   = SSN_DABS,
                    Email = "*****@*****.**"
                },
                new Person
                {
                    ID    = 2,
                    Name  = NAME_GUNNA,
                    SSN   = SSN_GUNNA,
                    Email = "*****@*****.**"
                }
            };
            #endregion

            #region Course templates

            var courseTemplates = new List<CourseTemplate>
            {
                new CourseTemplate
                {
                    CourseID    = COURSE_TEMPLID_VEFT,
                    Description = "Í þessum áfanga verður fjallað um vefþj...",
                    Name        = COURSE_NAME_VEFT
                },
                new CourseTemplate
                {
                    CourseID    = COURSE_TEMPLID_PROG,
                    Description = "Í þessum áfanga verður fjallað um grunngildi forr...",
                    Name        = COURSE_NAME_PROG
                },
                new CourseTemplate
                {
                    CourseID    = COURSE_TEMPLID_TGRA,
                    Description = "Í þessum áfagna verður fjallað um tölvug...",
                    Name        = COURSE_NAME_TGRA

                }
            };
            #endregion

            #region Courses
            var courses = new List<CourseInstance>
            {
                new CourseInstance
                {
                    ID         = COURSEID_VEFT_20153,
                    CourseID   = COURSE_TEMPLID_VEFT,
                    SemesterID = "20153"
                },
                new CourseInstance
                {
                    ID         = COURSEID_VEFT_20163,
                    CourseID   = COURSE_TEMPLID_VEFT,
                    SemesterID = "20163"
                },
                new CourseInstance
                {
                    ID         = COURSEID_PROG_20153,
                    CourseID   = COURSE_TEMPLID_PROG,
                    SemesterID = "20153"
                },
                new CourseInstance
                {
                    ID         = COURSEID_TGRA_20153,
                    CourseID   = COURSE_TEMPLID_TGRA,
                    SemesterID = "20153"
                },
                new CourseInstance
                {
                    ID         = COURSEID_TGRA_20157,
                    CourseID   = COURSE_TEMPLID_TGRA,
                    SemesterID = "20173"
                }
            };
            #endregion

            #region Teacher registrations
            _teacherRegistrations = new List<TeacherRegistration>
            {
                new TeacherRegistration
                {
                    ID               = 101,
                    CourseInstanceID = COURSEID_VEFT_20153,
                    SSN              = SSN_DABS,
                    Type             = TeacherType.MainTeacher
                },
                new TeacherRegistration
                {
                    ID               = 201,
                    CourseInstanceID = COURSEID_TGRA_20153,
                    SSN              = SSN_GUNNA,
                    Type             = TeacherType.MainTeacher
                }
            };
            #endregion

            _mockUnitOfWork.SetRepositoryData(persons);
            _mockUnitOfWork.SetRepositoryData(courseTemplates);
            _mockUnitOfWork.SetRepositoryData(courses);
            _mockUnitOfWork.SetRepositoryData(_teacherRegistrations);

            _service = new CoursesServiceProvider(_mockUnitOfWork);
        }
Exemplo n.º 8
0
		public void Setup()
		{
			_mockUnitOfWork = new MockUnitOfWork<MockDataContext>();

			#region Persons
			var persons = new List<Person>
			{
				// Of course I'm the first person,
				// did you expect anything else?
				new Person
				{
					ID    = 1,
					Name  = "Daníel B. Sigurgeirsson",
					SSN   = SSN_DABS,
					Email = "*****@*****.**"
				},
				new Person
				{
					ID    = 2,
					Name  = NAME_GUNNA,
					SSN   = SSN_GUNNA,
					Email = "*****@*****.**"
				}
			};
			#endregion

			#region Course templates

			var courseTemplates = new List<CourseTemplate>
			{
				new CourseTemplate
				{
					CourseID    = "T-514-VEFT",
					Description = "Í þessum áfanga verður fjallað um vefþj...",
					Name        = "Vefþjónustur"
				},
                new CourseTemplate
                {
                    CourseID     = "T-409-TSAM",
                    Description  = "Í þessum áfanga verður fjallað um tölvusamskipti..",
                    Name         = "Tölvusamskipti"
                },
                new CourseTemplate
                {
                    CourseID    = "T-302-HONN",
                    Description = "Í þessum áfanga..",
                    Name        = "Hönnun og smíði hugbúnaðar"
                }
			};
			#endregion

			#region Courses
			var courses = new List<CourseInstance>
			{
				new CourseInstance
				{
					ID         = COURSEID_VEFT_20153,
					CourseID   = "T-514-VEFT",
					SemesterID = "20153"
				},
				new CourseInstance
				{
					ID         = COURSEID_VEFT_20163,
					CourseID   = "T-514-VEFT",
					SemesterID = "20163"
				},
                new CourseInstance
                {
                    ID = COURSEID_TSAM_20153,
                    CourseID = "T-409-TSAM",
                    SemesterID = "20153"
                },
                new CourseInstance
                {
                    ID = COURSEID_HONN_20153,
                    CourseID = "T-302-HONN",
                    SemesterID = "20153"
                }
			};
			#endregion

			#region Teacher registrations
			_teacherRegistrations = new List<TeacherRegistration>
			{
				new TeacherRegistration
				{
					ID               = 101,
					CourseInstanceID = COURSEID_VEFT_20153,
					SSN              = SSN_DABS,
					Type             = TeacherType.MainTeacher
				},
                new TeacherRegistration
                {
                    ID               = 102,
                    CourseInstanceID = COURSEID_HONN_20153,
                    SSN              = SSN_GUNNA,
                    Type             = TeacherType.MainTeacher
                }
			};
			#endregion

			_mockUnitOfWork.SetRepositoryData(persons);
			_mockUnitOfWork.SetRepositoryData(courseTemplates);
			_mockUnitOfWork.SetRepositoryData(courses);
			_mockUnitOfWork.SetRepositoryData(_teacherRegistrations);

			// TODO: this would be the correct place to add 
			// more mock data to the mockUnitOfWork!

			_service = new CoursesServiceProvider(_mockUnitOfWork);
		}
        public void Setup()
        {
            _mockUnitOfWork = new MockUnitOfWork<MockDataContext>();

            #region Persons
            var persons = new List<Person>
            {
                // Of course I'm the first person,
                // did you expect anything else?
                new Person
                {
                    ID    = 1,
                    Name  = NAME_DABS,
                    SSN   = SSN_DABS,
                    Email = "*****@*****.**"
                },
                new Person
                {
                    ID    = 2,
                    Name  = NAME_GUNNA,
                    SSN   = SSN_GUNNA,
                    Email = "*****@*****.**"
                },
                new Person
                {
                    ID    = 3,
                    Name  = NAME_MARCEL,
                    SSN   = SSN_MARCEL,
                    Email = "*****@*****.**"
                }
            };
            #endregion

            #region Course templates

            var courseTemplates = new List<CourseTemplate>
            {
                new CourseTemplate
                {
                    CourseID    = "T-514-VEFT",
                    Description = "Í þessum áfanga verður fjallað um vefþj...",
                    Name        = "Vefþjónustur"
                },
                new CourseTemplate
                {
                    CourseID    = "T-409-TSAM",
                    Description = "Í þessum áfanga verður fjallað um samskipti...",
                    Name        = "Tölvusamskipti"
                }
            };
            #endregion

            #region Courses
            var courses = new List<CourseInstance>
            {
                new CourseInstance
                {
                    ID         = COURSEID_VEFT_20153,
                    CourseID   = "T-514-VEFT",
                    SemesterID = "20153"
                },
                new CourseInstance
                {
                    ID         = COURSEID_VEFT_20163,
                    CourseID   = "T-514-VEFT",
                    SemesterID = "20163"
                },
                new CourseInstance
                {
                    ID         = COURSEID_TSAM_20153,
                    CourseID   = "T-409-TSAM",
                    SemesterID = "20153"
                }
            };
            #endregion

            #region Teacher registrations
            _teacherRegistrations = new List<TeacherRegistration>
            {
                new TeacherRegistration
                {
                    ID               = 101,
                    CourseInstanceID = COURSEID_VEFT_20153,
                    SSN              = SSN_DABS,
                    Type             = TeacherType.MainTeacher
                }
            };
            #endregion

            _mockUnitOfWork.SetRepositoryData(persons);
            _mockUnitOfWork.SetRepositoryData(courseTemplates);
            _mockUnitOfWork.SetRepositoryData(courses);
            _mockUnitOfWork.SetRepositoryData(_teacherRegistrations);

            _service = new CoursesServiceProvider(_mockUnitOfWork);
        }
Exemplo n.º 10
0
		public void Setup()
		{
			_mockUnitOfWork = new MockUnitOfWork<MockDataContext>();

			#region Persons
			var persons = new List<Person>
			{
				// Of course I'm the first person,
				// did you expect anything else?
				new Person
				{
					ID    = 1,
					Name  = "Daníel B. Sigurgeirsson",
					SSN   = SSN_DABS,
					Email = "*****@*****.**"
				},
				new Person
				{
					ID    = 2,
					Name  = NAME_GUNNA,
					SSN   = SSN_GUNNA,
					Email = "*****@*****.**"
				},
                new Person
                {
                    ID      = 3,
                    Name    = "Hrafn Loftsson",
                    SSN     = SSN_HRAFN,
                    Email   = "*****@*****.**"
                }
			};
			#endregion

			#region Course templates

			var courseTemplates = new List<CourseTemplate>
			{
				new CourseTemplate
				{
					CourseID    = "T-514-VEFT",
					Description = "Í þessum áfanga verður fjallað um vefþj...",
					Name        = "Vefþjónustur"
				},
                new CourseTemplate
                {
                    CourseID    = "T-111-PROG",
                    Description = "Fyrstu skref í forritun...",
                    Name        = "Forritun"
                }
			};
            #endregion

            #region Courses
            var courses = new List<CourseInstance>
            {
                new CourseInstance
                {
                    ID         = COURSEID_VEFT_20153,
                    CourseID   = "T-514-VEFT",
                    SemesterID = "20153"
                },
                new CourseInstance
                {
                    ID         = COURSEID_VEFT_20163,
                    CourseID   = "T-514-VEFT",
                    SemesterID = "20163"
                },
                new CourseInstance
                {
                    ID = COURSEID_PROG_20163,
                    CourseID = "T-111-PROG",
                    SemesterID = "20163"
                }
			};
			#endregion

			#region Teacher registrations
			_teacherRegistrations = new List<TeacherRegistration>
			{
				new TeacherRegistration
				{
					ID               = 101,
					CourseInstanceID = COURSEID_VEFT_20153,
					SSN              = SSN_DABS,
					Type             = TeacherType.MainTeacher
				},
                new TeacherRegistration
                {
                    ID               = 102,
                    CourseInstanceID = COURSEID_PROG_20163,
                    SSN              = SSN_HRAFN,
                    Type             = TeacherType.MainTeacher
                }
			};
			#endregion

			_mockUnitOfWork.SetRepositoryData(persons);
			_mockUnitOfWork.SetRepositoryData(courseTemplates);
			_mockUnitOfWork.SetRepositoryData(courses);
			_mockUnitOfWork.SetRepositoryData(_teacherRegistrations);

			// TODO: this would be the correct place to add 
			// more mock data to the mockUnitOfWork!

			_service = new CoursesServiceProvider(_mockUnitOfWork);
		}
Exemplo n.º 11
0
        public CourseServicesTests()
        {
            _mockUnitOfWork = new MockUnitOfWork <MockDataContext>();

            #region Persons
            var persons = new List <Person>
            {
                new Person
                {
                    ID    = 1,
                    Name  = NAME_DABS,
                    SSN   = SSN_DABS,
                    Email = "*****@*****.**"
                },
                new Person
                {
                    ID    = 2,
                    Name  = NAME_GUNNA,
                    SSN   = SSN_GUNNA,
                    Email = "*****@*****.**"
                },
                new Person
                {
                    ID    = 3,
                    Name  = NAME_KHF,
                    SSN   = SSN_KHF,
                    Email = "*****@*****.**"
                }
            };
            #endregion

            #region Course templates

            var courseTemplates = new List <CourseTemplate>
            {
                new CourseTemplate
                {
                    CourseID    = "T-514-VEFT",
                    Description = "Í þessum áfanga verður fjallað um vefþj...",
                    Name        = "Vefþjónustur"
                },
                new CourseTemplate
                {
                    CourseID    = "T-111-PROG",
                    Description = "Í þessum áfanga verður fjallað um forritun...",
                    Name        = "Forritun"
                }
            };
            #endregion

            #region Courses
            var courses = new List <CourseInstance>
            {
                new CourseInstance
                {
                    ID         = COURSEID_VEFT_20143,
                    CourseID   = "T-514-VEFT",
                    SemesterID = "20143"
                },
                new CourseInstance
                {
                    ID         = COURSEID_VEFT_20153,
                    CourseID   = "T-514-VEFT",
                    SemesterID = "20153"
                },
                new CourseInstance
                {
                    ID         = COURSEID_VEFT_20163,
                    CourseID   = "T-514-VEFT",
                    SemesterID = "20163"
                },
                new CourseInstance
                {
                    ID         = COURSEID_PROG_20163,
                    CourseID   = "T-111-PROG",
                    SemesterID = "20163"
                }
            };
            #endregion

            #region Teacher registrations
            _teacherRegistrations = new List <TeacherRegistration>
            {
                new TeacherRegistration
                {
                    ID = 101,
                    CourseInstanceID = COURSEID_VEFT_20153,
                    SSN  = SSN_DABS,
                    Type = TeacherType.MainTeacher
                },
                new TeacherRegistration
                {
                    ID = 102,
                    CourseInstanceID = COURSEID_PROG_20163,
                    SSN  = SSN_KHF,
                    Type = TeacherType.AssistantTeacher
                }
            };
            #endregion

            _mockUnitOfWork.SetRepositoryData(persons);
            _mockUnitOfWork.SetRepositoryData(courseTemplates);
            _mockUnitOfWork.SetRepositoryData(courses);
            _mockUnitOfWork.SetRepositoryData(_teacherRegistrations);

            _service = new CoursesServiceProvider(_mockUnitOfWork);
        }