/// <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="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);