Ejemplo n.º 1
0
        public virtual async void TestDelete()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);
            var        client     = new ApiClient(testServer.CreateClient());

            client.SetBearerToken(JWTTestHelper.GenerateBearerToken());
            ApplicationDbContext context = testServer.Host.Services.GetService(typeof(ApplicationDbContext)) as ApplicationDbContext;

            IFileTypeService service = testServer.Host.Services.GetService(typeof(IFileTypeService)) as IFileTypeService;
            var model = new ApiFileTypeServerRequestModel();

            model.SetProperties("B");
            CreateResponse <ApiFileTypeServerResponseModel> createdResponse = await service.Create(model);

            createdResponse.Success.Should().BeTrue();

            ActionResponse deleteResult = await client.FileTypeDeleteAsync(2);

            deleteResult.Success.Should().BeTrue();
            ApiFileTypeServerResponseModel verifyResponse = await service.Get(2);

            verifyResponse.Should().BeNull();
        }
Ejemplo n.º 2
0
        public virtual async void TestUpdate()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);

            var client = new ApiClient(testServer.CreateClient());

            client.SetBearerToken(JWTTestHelper.GenerateBearerToken());
            var mapper = new ApiFileTypeServerModelMapper();
            ApplicationDbContext           context = testServer.Host.Services.GetService(typeof(ApplicationDbContext)) as ApplicationDbContext;
            IFileTypeService               service = testServer.Host.Services.GetService(typeof(IFileTypeService)) as IFileTypeService;
            ApiFileTypeServerResponseModel model   = await service.Get(1);

            ApiFileTypeClientRequestModel request = mapper.MapServerResponseToClientRequest(model);

            request.SetProperties("B");

            UpdateResponse <ApiFileTypeClientResponseModel> updateResponse = await client.FileTypeUpdateAsync(model.Id, request);

            context.Entry(context.Set <FileType>().ToList()[0]).Reload();
            updateResponse.Record.Should().NotBeNull();
            updateResponse.Success.Should().BeTrue();
            updateResponse.Record.Id.Should().Be(1);
            context.Set <FileType>().ToList()[0].Name.Should().Be("B");

            updateResponse.Record.Id.Should().Be(1);
            updateResponse.Record.Name.Should().Be("B");
        }
Ejemplo n.º 3
0
 public HomeController(IFolderService fodlerService, IUserService userService, IFileTypeService fileTypeService, IFileService fileService)
 {
     this.folderService   = fodlerService;
     this.userService     = userService;
     this.fileService     = fileService;
     this.fileTypeService = fileTypeService;
 }
Ejemplo n.º 4
0
 private static DataArchiveValidationService SetupDataArchiveValidationService(
     IFileTypeService fileTypeService = null)
 {
     return(new DataArchiveValidationService(
                fileTypeService ?? new Mock <IFileTypeService>().Object
                ));
 }
 public ValidatorService(
     ILogger <IValidatorService> logger,
     IFileStorageService fileStorageService,
     IFileTypeService fileTypeService,
     IImportStatusService importStatusService)
 {
     _logger              = logger;
     _fileStorageService  = fileStorageService;
     _fileTypeService     = fileTypeService;
     _importStatusService = importStatusService;
 }
 public AbstractFileTypeController(
     ApiSettings settings,
     ILogger <AbstractFileTypeController> logger,
     ITransactionCoordinator transactionCoordinator,
     IFileTypeService fileTypeService,
     IApiFileTypeModelMapper fileTypeModelMapper
     )
     : base(settings, logger, transactionCoordinator)
 {
     this.FileTypeService     = fileTypeService;
     this.FileTypeModelMapper = fileTypeModelMapper;
 }
Ejemplo n.º 7
0
 public ValidatorService(
     ILogger <IValidatorService> logger,
     IBlobStorageService blobStorageService,
     IFileTypeService fileTypeService,
     IDataImportService dataImportService,
     IImporterService importerService)
 {
     _logger             = logger;
     _blobStorageService = blobStorageService;
     _fileTypeService    = fileTypeService;
     _dataImportService  = dataImportService;
     _importerService    = importerService;
 }
Ejemplo n.º 8
0
 public FileTypeController(
     ApiSettings settings,
     ILogger <FileTypeController> logger,
     ITransactionCoordinator transactionCoordinator,
     IFileTypeService fileTypeService,
     IApiFileTypeServerModelMapper fileTypeModelMapper
     )
     : base(settings, logger, transactionCoordinator)
 {
     this.FileTypeService     = fileTypeService;
     this.FileTypeModelMapper = fileTypeModelMapper;
     this.BulkInsertLimit     = 250;
     this.MaxLimit            = 1000;
     this.DefaultLimit        = 250;
 }
Ejemplo n.º 9
0
 public DataArchiveValidationService(IFileTypeService fileTypeService)
 {
     _fileTypeService = fileTypeService;
 }
 public FileUploadsValidatorService(ISubjectService subjectService, IFileTypeService fileTypeService, ContentDbContext context)
 {
     _subjectService  = subjectService;
     _fileTypeService = fileTypeService;
     _context         = context;
 }
Ejemplo n.º 11
0
 public DataArchiveValidationService(IBlobStorageService blobStorageService, IFileTypeService fileTypeService)
 {
     _blobStorageService = blobStorageService;
     _fileTypeService    = fileTypeService;
 }
 public FileUploadsValidatorService(ISubjectRepository subjectRepository, IFileTypeService fileTypeService, ContentDbContext context)
 {
     _subjectRepository = subjectRepository;
     _fileTypeService   = fileTypeService;
     _context           = context;
 }
Ejemplo n.º 13
0
 public FileTypeController(IFileTypeService iFileTypeService, UserManager <User> userManager)
 {
     _iFileTypeService = iFileTypeService;
     _userManager      = userManager;
 }