Пример #1
0
        public When_Data_Import_Controller_Index_Is_Submitted_With_No_File()
        {
            _dataUploadDto = new DataUploadDto();

            var mapper = Substitute.For <IMapper>();

            _dataBlobUploadService = Substitute.For <IDataBlobUploadService>();
            _dataImportController  = new DataImportController(mapper, _dataBlobUploadService);

            var viewModel = new DataImportParametersViewModel
            {
                SelectedImportType = DataImportType.LearningAimReference
            };

            _result = _dataImportController.Index(viewModel).Result;
        }
        public When_Data_Import_Controller_Index_Is_Submitted_Successfully()
        {
            _dataUploadDto = new DataUploadDto();
            var formFile = Substitute.For <IFormFile>();

            var viewModel = new DataImportParametersViewModel
            {
                SelectedImportType = DataImportType.LearningAimReference,
                File = formFile
            };
            var mapper = Substitute.For <IMapper>();

            mapper.Map <DataUploadDto>(viewModel).Returns(_dataUploadDto);

            _dataBlobUploadService = Substitute.For <IDataBlobUploadService>();
            formFile.ContentType.Returns("application/vnd.ms-excel");

            var dataImportController = new DataImportController(mapper, _dataBlobUploadService);
            var controllerWithClaims = new ClaimsBuilder <DataImportController>(dataImportController)
                                       .AddUserName("username")
                                       .Build();

            _result = controllerWithClaims.Index(viewModel).Result;
        }
 public DataImportController(IMapper mapper, IDataBlobUploadService dataBlobUploadService)
 {
     _mapper = mapper;
     _dataBlobUploadService = dataBlobUploadService;
 }