示例#1
0
        public void AcceptTest(SyllabusManagerUser user, Syllabus input, Syllabus output, bool expectedResult)
        {
            // Arrange
            var dbSetMock = new Mock <DbSet <Syllabus> >();

            dbSetMock
            .Setup(r => r.Find(input.Id))
            .Returns(input);
            var syllabusService = new SyllabusService(SyllabusTestRepository.GetInMemorySyllabusContext(), null, dbSetMock.Object);

            // Act
            var result = syllabusService.Accept(input.Id, user);

            // Assert
            Assert.Equal(expectedResult, result);
            Assert.Equal(output.StudentGovernmentOpinion, input.StudentGovernmentOpinion);
            Assert.Equal(output.State, input.State);
            Assert.Equal(output.StudentRepresentativeName, input.StudentRepresentativeName);
            if (output.ApprovalDate is null)
            {
                Assert.Null(input.ApprovalDate);
            }
            else
            {
                Assert.NotNull(input.ApprovalDate);
            }
            if (output.ValidFrom is null)
            {
                Assert.Null(input.ValidFrom);
            }
            else
            {
                Assert.NotNull(input.ValidFrom);
            }
        }
示例#2
0
        public async Task GetLatestTest(FieldOfStudy fos, LearningOutcomeDocument input, LearningOutcomeDocument expectedOutcome)
        {
            // Arrange
            var dbContext = SyllabusTestRepository.GetInMemorySyllabusContext();

            dbContext.FieldsOfStudies.Add(fos);
            if (input != null)
            {
                dbContext.LearningOutcomeDocuments.Add(input);
            }
            dbContext.SaveChanges();

            var manager = new LearningOutcomeService(dbContext, null, null);

            // Act
            var actualResult = await manager.Latest("TEST001", "2020/2021");

            // Assert
            Assert.Equal(expectedOutcome.Id, actualResult.Id);
            Assert.Equal(expectedOutcome.Version, actualResult.Version);
            Assert.Equal(expectedOutcome.AcademicYear, actualResult.AcademicYear);
            Assert.Equal(expectedOutcome.FieldOfStudy.Code, actualResult.FieldOfStudy.Code);
            Assert.Equal(expectedOutcome.LearningOutcomes.Count, actualResult.LearningOutcomes.Count);
            Assert.Equal(expectedOutcome.IsDeleted, actualResult.IsDeleted);
        }