public void DeleteAnnotationOnSubmissionForUser_InvalidArguments(int submissionId, int userId) { // Arrange SOVAContext databaseContext = new SOVAContext(_connectionString); AnnotationRepository annotationRepository = new AnnotationRepository(databaseContext); // Act bool deleted = annotationRepository.Delete(submissionId, userId); // Assert Assert.False(deleted); }
public void CheckAtMostOneAnnotationOnSubmissionForUser_CreateAnnotation(string annotation, int submissionId, int userId) { // Arrange SOVAContext databaseContext = new SOVAContext(_connectionString); AnnotationRepository annotationRepository = new AnnotationRepository(databaseContext); // Act annotationRepository.Create(annotation, submissionId, userId); // Assert annotationRepository.Delete(submissionId, userId); int annotationCount = databaseContext.Annotations.Where(annotation => annotation.UserId == userId && annotation.SubmissionId == submissionId).Count(); Assert.True(annotationCount <= 1); }
public void DeleteAnnotationOnSubmissionForUser_ValidArguments() { // Arrange SOVAContext databaseContext = new SOVAContext(_connectionString); AnnotationRepository annotationRepository = new AnnotationRepository(databaseContext); int submissionId = 19; User testUser = EnsureTestUserExistsThroughContext_ReturnsTestUser(); // Act bool deleted = annotationRepository.Delete(submissionId, testUser.Id); // Assert Assert.True(deleted); }