Beispiel #1
0
        protected GlacierGatewayTestBase(bool testMode)
        {
            _logger          = Substitute.For <ILogger <GlacierGateway> >();
            _glacier         = Substitute.For <IAmazonGlacier>();
            _updater         = Substitute.For <IConsolePercentUpdater>();
            _archiveProvider = Substitute.For <IArchiveProvider>();

            // We need to initialize the MemoryStream with some data so that
            // the sanity checks don't fail
            var bytes = Enumerable.Range(0, 100).Select(a => (byte)a).ToArray();

            _archiveProvider.GetFileStream(Arg.Any <string>(), Arg.Any <string>()).Returns(new MemoryStream(bytes));

            _sut = new GlacierGateway(_glacier, _logger, _updater, _archiveProvider, null, testMode);

            _glacier.ListVaultsAsync(Arg.Any <ListVaultsRequest>())
            .Returns(new ListVaultsResponse
            {
                VaultList = new List <DescribeVaultOutput>
                {
                    new DescribeVaultOutput
                    {
                        VaultName = PreexistingVaultName
                    }
                }
            });
            _glacier.CreateVaultAsync(Arg.Any <CreateVaultRequest>())
            .Returns(new CreateVaultResponse
            {
                HttpStatusCode = HttpStatusCode.OK
            });
        }
Beispiel #2
0
 /// <summary> Creates operation implementation dependent upon type </summary>
 public OperationFactory(IAppConfig appConfig,
                         IArchiveProvider archiveProvider,
                         IFileSystem fileSystem)
 {
     _appConfig       = appConfig;
     _archiveProvider = archiveProvider;
     _fileSystem      = fileSystem;
 }
Beispiel #3
0
 /// <summary> Implements compression logic methods </summary>
 public CompressionOperation(IAppConfig appConfig,
                             IArchiveProvider archiveProvider,
                             IFileSystem fileSystem)
 {
     _appConfig       = appConfig;
     _archiveProvider = archiveProvider;
     _fileSystem      = fileSystem;
 }
 public GlacierGateway(IAmazonGlacier glacier, ILogger <GlacierGateway> logger,
                       IConsolePercentUpdater updater, IArchiveProvider archiveProvider,
                       string accountId, bool testMode)
 {
     _glacier         = glacier;
     _logger          = logger;
     _updater         = updater;
     _archiveProvider = archiveProvider;
     _accountId       = accountId;
     _testMode        = testMode;
 }
Beispiel #5
0
        public static IServiceCollection Create(this IServiceCollection ignore, IContentRepository contentRepo, IArchiveProvider archiveProvider, IContactProvider contactProvider, ISearchProvider searchProvider, IPageGenerator pageGen, IHomePageGenerator homePageGen, INavigationProvider navProvider, IRedirectProvider redirectProvider, ISyndicationProvider syndicationProvider, ISettings settings, IEnumerable <Category> categories, IContentEncoder contentEncoder, IContentItemPageGenerator contentItemPageGen)
        {
            IServiceCollection container = new ServiceCollection();

            container.AddSingleton <IPageGenerator>(pageGen);
            container.AddSingleton <IHomePageGenerator>(homePageGen);
            container.AddSingleton <INavigationProvider>(navProvider);
            container.AddSingleton <IArchiveProvider>(archiveProvider);
            container.AddSingleton <IContactProvider>(contactProvider);
            container.AddSingleton <ISearchProvider>(searchProvider);
            container.AddSingleton <ISyndicationProvider>(syndicationProvider);
            container.AddSingleton <IEnumerable <Category> >(categories);
            container.AddSingleton <IRedirectProvider>(redirectProvider);
            container.AddSingleton <IContentEncoder>(contentEncoder);
            container.AddSingleton <IContentItemPageGenerator>(contentItemPageGen);

            container.AddSingleton <IContentRepository>(contentRepo);
            settings.SourceConnection = contentRepo.GetSourceConnection();
            container.AddSingleton <ISettings>(settings);

            return(container);
        }
Beispiel #6
0
 public ReadOnlyAVFS(IArchiveProvider archiveProvider)
 {
     this.archiveProvider = archiveProvider;
 }
Beispiel #7
0
 public static IArchiveProvider Create(this IArchiveProvider ignore, IServiceProvider serviceProvider)
 {
     return(new BasicProvider(serviceProvider));
 }
Beispiel #8
0
        public static IArchiveProvider Create(this IArchiveProvider ignore)
        {
            IServiceCollection container = (null as IServiceCollection).Create();

            return(ignore.Create(container.BuildServiceProvider()));
        }
Beispiel #9
0
 public MainViewModel()
 {
     _archiveProvider = new ArchiveProvider(new MD5Hash());
 }