public void ArrangeAndAct()
        {
            _folder    = "vgn6to834nchgiyoewrngcyfueiwrgcnytr4";
            _filePaths = new[]
            {
                "vngtyicnhyucikw",
                "ny6ft5874386ngdtyrugw22dfr",
                "bhj765ghyegft43"
            };


            _filePathsProvider = A.Fake <IFilePathsProvider>();
            A.CallTo(() => _filePathsProvider.GetFilePathsFromFolder(_folder)).Returns(_filePaths);

            _fileContentProvider = A.Fake <IFileContentProvider>();
            _content1            = "n7g9865yn3879gchyruicgchu542";
            A.CallTo(() => _fileContentProvider.GetDataFrom(_filePaths[0])).Returns(_content1);
            A.CallTo(() => _fileContentProvider.GetDataFrom(_filePaths[1])).Throws <Exception>();
            _content3 = "vhy67538ongt87rw2nfgrycngfyr42";
            A.CallTo(() => _fileContentProvider.GetDataFrom(_filePaths[2])).Returns(_content3);

            _dbFactory = A.Fake <IDbFactory>();
            _db        = A.Fake <IDb>();
            A.CallTo(() => _dbFactory.Create()).Returns(_db);

            _out = new FilesProcessor(_filePathsProvider, _fileContentProvider, _dbFactory);

            //act
            _out.ProcessFilesFromFolder(_folder);
        }
コード例 #2
0
        public FilesController(
            ILogger logger,
            IResolver resolver,
            IFileContentProvider contentProvider,
            IReadRepository <File, ulong> readFileRepo,
            IUpdateRepository <File, ulong> updateFileRepo,
            ICreateRepository <File, ulong> createFileRepo,
            IRemoveRepository <File, ulong> removeFileRepo,
            IDeleteRepository <File, ulong> deleteFileRepo) : base(logger, resolver)
        {
            mReadFileRepo   = readFileRepo;
            mUpdateFileRepo = updateFileRepo;
            mCreateFileRepo = createFileRepo;
            mRemoveFileRepo = removeFileRepo;
            mDeleteFileRepo = deleteFileRepo;

            mContentProvider = contentProvider;
        }
コード例 #3
0
 public ResourceHandler(RequestContext requestContext, IFileContentProvider fileContentProvider)
     : base(requestContext)
 {
     this.fileContentProvider = fileContentProvider;
 }
コード例 #4
0
 public JsonDataProvider(IFileContentProvider fileContentProvider, IMemoryCache cache)
 {
     _fileContentProvider = fileContentProvider ?? throw new ArgumentNullException(nameof(fileContentProvider));
     _cache = cache ?? throw new ArgumentNullException(nameof(cache));
 }