コード例 #1
0
        public async Task FailIfStudyIsMissingName(string name)
        {
            await ClearTestDatabase();

            var studyCreateService = StudyServiceMockFactory.CreateService(_serviceProvider);

            var studyWithInvalidName = new StudyCreateDto()
            {
                Name   = name,
                Vendor = "Bouvet"
            };

            await Assert.ThrowsAsync <ArgumentException>(() => studyCreateService.CreateAsync(studyWithInvalidName));
        }
コード例 #2
0
        public async void FailIfStudyIsMissingVendor(string vendor)
        {
            await ClearTestDatabase();

            var studyCreateService = StudyServiceMockFactory.CreateService(_serviceProvider);

            var studyWithInvalidVendor = new StudyCreateDto()
            {
                Name   = "TestStudy",
                Vendor = vendor
            };

            await Assert.ThrowsAsync <ArgumentException>(() => studyCreateService.CreateAsync(studyWithInvalidVendor));
        }
コード例 #3
0
        public async void CloseStudyAsync_ShouldClose_IfStudyExists()
        {
            await ClearTestDatabase();

            var studyDeleteService = StudyServiceMockFactory.DeleteService(_serviceProvider);

            var initialStudy = new StudyCreateDto()
            {
                Name   = "TestStudy12345",
                Vendor = "Equinor"
            };

            var studyCreateService = StudyServiceMockFactory.CreateService(_serviceProvider);
            var createdStudy       = await studyCreateService.CreateAsync(initialStudy);

            await studyDeleteService.CloseStudyAsync(createdStudy.Id);

            var studyReadService = StudyServiceMockFactory.StudyEfModelService(_serviceProvider);

            _ = await Assert.ThrowsAsync <NotFoundException>(() => studyReadService.GetByIdAsync(createdStudy.Id, UserOperation.Study_Read));
        }
コード例 #4
0
        public async void UpdatingStudyDetailsWithoutRequiredFieldsShouldBeWellHandled(string name, string vendor)
        {
            await ClearTestDatabase();

            var studyCreateService = StudyServiceMockFactory.CreateService(_serviceProvider);

            var initialStudy = new StudyCreateDto()
            {
                Name   = "TestStudy12345",
                Vendor = "Equinor"
            };

            var createdStudy = await studyCreateService.CreateAsync(initialStudy);

            var studyWithoutReqFields = new StudyUpdateDto()
            {
                Name   = name,
                Vendor = vendor
            };

            var studyUpdateService = StudyServiceMockFactory.UpdateService(_serviceProvider);
            await Assert.ThrowsAsync <ArgumentException>(() => studyUpdateService.UpdateMetadataAsync(createdStudy.Id, studyWithoutReqFields));
        }