コード例 #1
0
ファイル: DataServiceTests.cs プロジェクト: ivanspajic/SOVA
        public void GetAnnotationBySubmissionAndUserIds_InvalidArguments(int submissionId, int userId)
        {
            // Arrange
            SOVAContext          databaseContext      = new SOVAContext(_connectionString);
            AnnotationRepository annotationRepository = new AnnotationRepository(databaseContext);

            // Act
            Annotation actualAnnotation = annotationRepository.GetBySubmissionAndUserIds(submissionId, userId);

            // Assert
            Assert.Null(actualAnnotation);
        }
コード例 #2
0
ファイル: DataServiceTests.cs プロジェクト: ivanspajic/SOVA
        public void GetAnnotationBySubmissionAndUserIds_AnnotationWithSubmission()
        {
            // Arrange
            SOVAContext          databaseContext      = new SOVAContext(_connectionString);
            AnnotationRepository annotationRepository = new AnnotationRepository(databaseContext);

            int submissionId = 19;

            User testUser = EnsureTestUserExistsThroughContext_ReturnsTestUser();

            EnsureTestAnnotationExistsThroughContext_ReturnsTestAnnotation(testUser.Id);

            // Act
            Annotation annotation = annotationRepository.GetBySubmissionAndUserIds(submissionId, testUser.Id);

            // Assert
            Assert.Equal(submissionId, annotation.SubmissionId);
        }
コード例 #3
0
ファイル: DataServiceTests.cs プロジェクト: ivanspajic/SOVA
        public void GetAnnotationBySubmissionAndUserIds_ValidArguments()
        {
            // Arrange
            SOVAContext          databaseContext      = new SOVAContext(_connectionString);
            AnnotationRepository annotationRepository = new AnnotationRepository(databaseContext);

            string annotation   = "Something here";
            int    submissionId = 19;
            int    userId       = 1;

            // Act
            annotationRepository.Create(annotation, submissionId, userId);
            Annotation actualAnnotation = annotationRepository.GetBySubmissionAndUserIds(submissionId, userId);

            // Assert
            Assert.Equal(annotation, actualAnnotation.AnnotationString);
            Assert.Equal(submissionId, actualAnnotation.SubmissionId);
            Assert.Equal(userId, actualAnnotation.UserId);
        }