Example #1
0
        /// <summary>
        /// initialises the storage path provider
        /// </summary>
        public StoragePathProvider(IProvideApplicationSettings settings)
        {
            It.IsNull(settings)
            .AsGuard <ArgumentNullException>(nameof(settings));

            Settings = settings;

            DocumentStoreID            = Settings.GetVariable(DocumentStoreIDKey);
            LocalAuthorityCollectionID = Settings.GetVariable(LocalAuthorityCollectionIDKey);

            LocalAuthorityCollection = UriFactory.CreateDocumentCollectionUri(DocumentStoreID, LocalAuthorityCollectionID);
        }
Example #2
0
        /// <summary>
        /// initialises an instance of the <see cref="DocumentStore"/>
        /// </summary>
        /// <param name="usingEnvironment">using environment variables</param>
        public DocumentStore(
            IProvideApplicationSettings usingEnvironment,
            ICreateDocumentClients factory,
            IProvideSafeOperations safeOperations)
        {
            It.IsNull(usingEnvironment)
            .AsGuard <ArgumentNullException>(nameof(usingEnvironment));
            It.IsNull(factory)
            .AsGuard <ArgumentNullException>(nameof(factory));
            It.IsNull(safeOperations)
            .AsGuard <ArgumentNullException>(nameof(safeOperations));

            EndpointAddress = usingEnvironment.GetVariable(DocumentStoreEndpointAddressKey);
            It.IsEmpty(EndpointAddress)
            .AsGuard <ArgumentNullException>(nameof(EndpointAddress));

            AccountKey = usingEnvironment.GetVariable(DocumentStoreAccountKey);
            It.IsEmpty(AccountKey)
            .AsGuard <ArgumentNullException>(nameof(AccountKey));

            Client         = factory.CreateClient(new Uri(EndpointAddress), AccountKey);
            SafeOperations = safeOperations;
        }
 /// <summary>
 /// make (a) 'system under test'
 /// </summary>
 /// <param name="paths">the storage paths provider</param>
 /// <param name="store">the document store</param>
 /// <returns>the system under test</returns>
 internal StoragePathProvider MakeSUT(
     IProvideApplicationSettings settings) =>
 new StoragePathProvider(settings);
 /// <summary>
 /// make (a) 'system under test'
 /// </summary>
 /// <param name="settings">the application settings provider</param>
 /// <param name="factory">the document client factory</param>
 /// <param name="safeOperator">the safe operations provider</param>
 /// <returns>the system under test</returns>
 internal DocumentStore MakeSUT(
     IProvideApplicationSettings settings,
     ICreateDocumentClients factory,
     IProvideSafeOperations safeOperator) =>
 new DocumentStore(settings, factory, safeOperator);