示例#1
0
 public Documentation(IAssemblyLoader assemblyLoader, ICommentLoader commentLoader, IDocumentModelBuilder modelBuilder, IDocumentWriter documentWriter)
 {
     _assemblyLoader = assemblyLoader;
     _commentLoader = commentLoader;
     _modelBuilder = modelBuilder;
     _documentWriter = documentWriter;
 }
示例#2
0
        public WebSocketWriterPipeline(WebSocket socket, IDocumentWriter documentWriter)
        {
            _socket         = socket;
            _documentWriter = documentWriter;

            _startBlock = CreateMessageWriter();
        }
 public GraphQLProcessor(GraphQLQuery graphQlQuery, ISchema schema, IDocumentExecuter executer, IDocumentWriter writer)
 {
     _graphQLQuery = graphQlQuery;
     _schema       = schema;
     _executer     = executer;
     _writer       = writer;
 }
示例#4
0
 public ValueTypeWriter(IDocumentWriter ownerDocument, IMemberWriter memberWriter,
                        ITypeNamesCache typeNamesCache)
 {
     this.ownerDocument  = ownerDocument;
     this.memberWriter   = memberWriter;
     this.typeNamesCache = typeNamesCache;
 }
示例#5
0
        private Task WriteResponseAsync(HttpContext context, IDocumentWriter writer, ExecutionResult result)
        {
            context.Response.ContentType = JsonContentType;
            context.Response.StatusCode  = (int)HttpStatusCode.OK;

            return(writer.WriteAsync(context.Response.Body, result));
        }
示例#6
0
 public GraphQlService(ISchema schema, IDocumentExecuter executer, IDocumentWriter writer, GraphQlUserContext ctx)
 {
     _schema   = schema;
     _executer = executer;
     _writer   = writer;
     _ctx      = ctx;
 }
 public GraphQlController(IDocumentExecuter documentExecuter, IDocumentWriter documentWriter,
                          ISchema schema)
 {
     _documentExecuter = documentExecuter;
     _documentWriter   = documentWriter;
     _schema           = schema;
 }
示例#8
0
 public ValueWriter(IDocumentWriter ownerDocument, IObjectWriter[] objectWriters,
                    IBaseTypeMembersWriter[] baseTypeMembersWriters)
 {
     this.ownerDocument          = ownerDocument;
     writers                     = objectWriters;
     this.baseTypeMembersWriters = baseTypeMembersWriters;
 }
示例#9
0
 public AddQuestionProcessor(IDocumentReader <QuestionDto> reader, IDocumentWriter <QuestionDto> writer)
 {
     _reader          = reader;
     _writer          = writer;
     _dtoParser       = new QuestionDtoParser();
     _domainValidator = new DomainValidator();
 }
 public GraphQLProcessor(IDocumentExecuter executer,
                         IDocumentWriter writer, TrainingPlanSchema schema)
 {
     _executer = executer;
     _writer   = writer;
     _schema   = schema;
 }
示例#11
0
 public GraphQLController(IDocumentExecuter executer, IDocumentWriter writer, TestSchema schema, DataLoaderDocumentListener dataLoaderListener)
 {
     _executer           = executer;
     _writer             = writer;
     _schema             = schema;
     _dataLoaderListener = dataLoaderListener;
 }
示例#12
0
 public AppHost(IAzureSearch azureSearchService, IInsightsReader <T> insightsReaderService, IDocumentWriter documentWriterService, ILog logger)
 {
     _azureSearchService    = azureSearchService;
     _insightsReaderService = insightsReaderService;
     _documentWriterService = documentWriterService;
     _logger = logger;
 }
        private async Task WriteResponsesAsync(HttpContext context, IDocumentWriter writer, ExecutionResult[] results)
        {
            context.Response.ContentType = "application/json";
            context.Response.StatusCode  = 200;

            if (results.Length == 1)
            {
                await writer.WriteAsync(context.Response.Body, results[0]);

                return;
            }

            using (var sw = new StreamWriter(context.Response.Body, Encoding.UTF8))
            {
                sw.AutoFlush = true;
                sw.Write("[");
                for (int i = 0; i <= results.Length - 2; i++)
                {
                    await writer.WriteAsync(context.Response.Body, results[i]);

                    sw.Write(",");
                }
                await writer.WriteAsync(context.Response.Body, results[results.Length - 1]);

                sw.Write("]");
            }
        }
示例#14
0
 public ValueWriter(IDocumentWriter ownerDocument, IObjectWriter[] objectWriters,
     IBaseTypeMembersWriter[] baseTypeMembersWriters)
 {
     this.ownerDocument = ownerDocument;
     writers = objectWriters;
     this.baseTypeMembersWriters = baseTypeMembersWriters;
 }
        /// <summary>
        ///     Initializes a new instance of the <see cref="GraphQLMiddleware" /> class.
        /// </summary>
        /// <param name="next">
        ///     The next request delegate.
        /// </param>
        /// <param name="options">
        ///     The GraphQL options.
        /// </param>
        /// <exception cref="ArgumentNullException">
        ///     Throws <see cref="ArgumentNullException" /> if <paramref name="next" /> or <paramref name="options" /> is null.
        /// </exception>
        public GraphQLMiddleware(RequestDelegate next, IOptions <GraphQLOptions> options, ISchema _schema, IDocumentExecuter _executer, IDocumentWriter _writer)
        {
            if (next == null)
            {
                throw new ArgumentNullException(nameof(next));
            }
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }
            if (_schema == null)
            {
                throw new ArgumentException("Schema is null");
            }
            if (_executer == null)
            {
                throw new ArgumentException("Document Executer is null");
            }
            if (_writer == null)
            {
                throw new ArgumentException("Document Writer is null");
            }

            this.next = next;
            var optionsValue = options.Value;

            graphqlPath = string.IsNullOrEmpty(optionsValue?.GraphQLPath) ? GraphQLOptions.DefaultGraphQLPath : optionsValue.GraphQLPath;
            schema      = _schema;
            executer    = _executer;
            writer      = _writer;
        }
 public ArrayOfDoublesXmlWriter(IDocumentWriter ownerDocument, IValuesCache valuesCache,
     ITypeNamesCache typeNamesCache)
 {
     this.ownerDocument = ownerDocument;
     this.valuesCache = valuesCache;
     this.typeNamesCache = typeNamesCache;
 }
示例#17
0
        public async Task should_map(IDocumentWriter documentWriter)
        {
            var documentExecuter = new DocumentExecuter();
            var executionResult  = await documentExecuter.ExecuteAsync(_ =>
            {
                _.Schema = new Issue2275Schema();
                _.Query  = @"query($data:Input!) {
                                request(data: $data)
                }";
                _.Inputs = @" {
                    ""data"": {
                        ""clientId"": 2,
                        ""filters"": [{
                            ""key"": ""o"",
                            ""value"": 25
                        }]
                    }
                }".ToInputs();
            });

            var json = await documentWriter.WriteToStringAsync(executionResult);

            executionResult.Errors.ShouldBeNull();

            json.ShouldBe(@"{
  ""data"": {
    ""request"": ""2: [o=25]""
  }
}");
        }
        public void GenerateFiles(IDocumentWriter documentWriter)
        {
            // API clients/endpoints
            var resourcesGenerator = new CSharpApiModelResourceGenerator(_codeGenerationContext);

            foreach (var apiResource in _codeGenerationContext.GetResources())
            {
                WriteToDocument(documentWriter,
                                apiResource.ToCSharpIdentifierSingular() + "Client.generated.cs",
                                resourcesGenerator.GenerateResourceDefinition(apiResource));
            }

            // URL parameters
            var urlParametersGenerator = new CSharpApiModelUrlParameterGenerator(_codeGenerationContext);

            foreach (var apiUrlParameter in _codeGenerationContext.GetUrlParameters())
            {
                WriteToDocument(documentWriter,
                                "UrlParams/" + apiUrlParameter.ToCSharpClassName() + ".generated.cs",
                                urlParametersGenerator.GenerateUrlParameterDefinition(apiUrlParameter));
            }

            // Enums
            var enumGenerator = new CSharpApiModelEnumGenerator();

            foreach (var apiEnum in _codeGenerationContext.GetEnums())
            {
                WriteToDocument(documentWriter,
                                "Enums/" + apiEnum.ToCSharpClassName() + ".generated.cs",
                                enumGenerator.GenerateEnumDefinition(apiEnum));
            }

            // Dtos
            var dtoGenerator = new CSharpApiModelDtoGenerator(_codeGenerationContext);

            foreach (var apiDto in _codeGenerationContext.GetDtos())
            {
                WriteToDocument(documentWriter,
                                "Dtos/" + apiDto.ToCSharpClassName() + ".generated.cs",
                                dtoGenerator.GenerateDtoDefinition(apiDto));
            }

            // Partial extensions
            var partialExtensionsGenerator = new CSharpPartialExtensionsGenerator(_codeGenerationContext);

            foreach (var apiDto in _codeGenerationContext.GetDtos())
            {
                WriteToDocument(documentWriter,
                                "Partials/" + apiDto.ToCSharpClassName() + "PartialBuilder.generated.cs",
                                partialExtensionsGenerator.GeneratePartialClassFor(apiDto),
                                apiDto.ToCSharpClassName() + "PartialBuilder");
            }

            // Menu ids
            var menuIdsGenerator = new CSharpApiModelMenuIdGenerator(_codeGenerationContext);

            WriteToDocument(documentWriter,
                            "MenuIds.generated.cs",
                            menuIdsGenerator.GenerateMenuIds(_codeGenerationContext.GetMenuIds()));
        }
示例#19
0
 public GraphQLMiddleware(RequestDelegate next, GraphQLSettings settings, IDocumentWriter writer, IDocumentExecuter executor)
 {
     _next     = next;
     _settings = settings;
     _writer   = writer;
     _executor = executor;
 }
 //
 // Summary:
 //     /// Method responsible for initializing the middleware. ///
 //
 // Parameters:
 //   next:
 //     The next param.
 //
 //   documentWriter:
 //     The documentWriter param.
 //
 //   documentExecutor:
 //     The documentExecutor param.
 //
 public GraphQLMiddleware(RequestDelegate next, IDocumentWriter documentWriter, IDocumentExecuter documentExecutor, IEnumerable <IValidationRule> validationRules)
 {
     _next             = next;
     _documentWriter   = documentWriter;
     _documentExecutor = documentExecutor;
     _validationRules  = validationRules;
 }
        public void SetUp()
        {
            var config = new DocumentStoreTestConfiguration();

            MongoDbTestConnectionProvider.DropTestsTenant();
            config.SetTestAddress(TestConfig.ServerAddress);
            _documentStoreService = new DocumentStoreBootstrapper();
            _documentStoreService.Start(config);

            TenantContext.Enter(new TenantId(TestConfig.Tenant));
            var tenant = ContainerAccessor.Instance.Resolve <TenantManager>().Current;

            _bus       = tenant.Container.Resolve <ICommandBus>();
            _filestore = tenant.Container.Resolve <IBlobStore>();
            Assert.IsTrue(_bus is IInProcessCommandBus);

            //Issue: https://github.com/ProximoSrl/Jarvis.DocumentStore/issues/26
            //you need to resolve the IReader that in turns resolves the ProjectionEngine, becauase if you
            //directly resolve the ITriggerProjectionsUpdate, projection engine will be resolved multiple times.
            tenant.Container.Resolve <IReader <StreamReadModel, Int64> >();
            _projections = tenant.Container.Resolve <ITriggerProjectionsUpdate>();

            _handleWriter   = tenant.Container.Resolve <IDocumentWriter>();
            _documentReader = tenant.Container.Resolve <IReader <DocumentDescriptorReadModel, DocumentDescriptorId> >();
        }
示例#22
0
 public GraphQLMiddleware(RequestDelegate next, GraphQLSettings settings, IDocumentExecuter executer, IDocumentWriter writer)
 {
     this.next     = next;
     this.settings = settings;
     this.executer = executer;
     this.writer   = writer;
 }
        public GraphQLEndpointHandler(
            ILogger <GraphQLEndpointHandler> logger,
            DataStreamRegistry registry,
            IDocumentExecuter executor,
            IDocumentWriter writer)
        {
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            if (registry == null)
            {
                throw new ArgumentNullException(nameof(registry));
            }

            if (executor == null)
            {
                throw new ArgumentNullException(nameof(executor));
            }

            if (writer == null)
            {
                throw new ArgumentNullException(nameof(writer));
            }

            _logger   = logger;
            _registry = registry;
            _executor = executor;
            _writer   = writer;
        }
示例#24
0
 public ValueTypeWriter(IDocumentWriter ownerDocument, IMemberWriter memberWriter,
     ITypeNamesCache typeNamesCache)
 {
     this.ownerDocument = ownerDocument;
     this.memberWriter = memberWriter;
     this.typeNamesCache = typeNamesCache;
 }
示例#25
0
        private static Task WriteUnauthorizedResponseAsync(HttpContext context, IDocumentWriter writer, ExecutionResult result)
        {
            context.Response.ContentType = "application/json";
            context.Response.StatusCode  = (int)HttpStatusCode.Unauthorized;

            return(writer.WriteAsync(context.Response.Body, result));
        }
 public GqlMiddleware(RequestDelegate next, IDocumentWriter writer, IDocumentExecuter executor, ISchema schema)
 {
     this._next     = next;
     this._writer   = writer;
     this._executor = executor;
     this._schema   = schema;
 }
 public StreamProjection(
     ICollectionWrapper <StreamReadModel, Int64> streamReadModelCollection,
     IDocumentWriter documentWriter,
     IBlobStore blobStore,
     IQueueManager queueDispatcher,
     IReader <DocumentDescriptorReadModel, DocumentDescriptorId> documentDescriptorReadModel)
 {
     if (queueDispatcher is IObserveProjection)
     {
         Observe(queueDispatcher as IObserveProjection);
     }
     _streamReadModelCollection   = streamReadModelCollection;
     _documentDescriptorReadModel = documentDescriptorReadModel;
     _documentWriter = documentWriter;
     _blobStore      = blobStore;
     _streamReadModelCollection.Attach(this, false);
     if (_streamReadModelCollection.All.Any())
     {
         _lastId = _streamReadModelCollection.All.Max(s => s.Id);
     }
     else
     {
         _lastId = 0;
     }
 }
示例#28
0
 public WordsFileListWriter(WordFilesStoredSettings wordFilesStoredSettings, IDocumentWriter <Word> documentWriter
                            , ILogger <WordsFileListWriter> logger)
 {
     _wordFilesStoredSettings = wordFilesStoredSettings;
     _documentWriter          = documentWriter;
     _logger = logger;
 }
        public async Task serialization_should_have_correct_case(IDocumentWriter writer)
        {
            var trace    = new ApolloTrace(new DateTime(2019, 12, 05, 15, 38, 00, DateTimeKind.Utc), 102.5);
            var expected = @"{
  ""version"": 1,
  ""startTime"": ""2019-12-05T15:38:00Z"",
  ""endTime"": ""2019-12-05T15:38:00.103Z"",
  ""duration"": 102500000,
  ""parsing"": {
    ""startOffset"": 0,
    ""duration"": 0
  },
  ""validation"": {
    ""startOffset"": 0,
    ""duration"": 0
  },
  ""execution"": {
    ""resolvers"": []
  }
}";

            var result = await writer.WriteToStringAsync(trace);

            result.ShouldBeCrossPlat(expected);
        }
示例#30
0
 public GraphQLMiddleware(RequestDelegate next, IDocumentWriter writer, IDocumentExecuter executor, ILogger <GraphQLMiddleware> logger)
 {
     _next     = next;
     _writer   = writer;
     _executor = executor;
     _logger   = logger;
 }
示例#31
0
 public GraphQLMiddleware(RequestDelegate next, IDocumentWriter writer, IDocumentExecuter executor, ISchema schema)
 {
     _next     = next;
     _writer   = writer;
     _executor = executor;
     _schema   = schema;
 }
示例#32
0
        private Task WriteResponseAsync(HttpContext context, IDocumentWriter writer, ExecutionResult result)
        {
            context.Response.ContentType = "application/json";
            context.Response.StatusCode  = 200; // OK

            return(writer.WriteAsync(context.Response.Body, result));
        }
        public void REGISTER_PROJECTIONS()
        {
            var appendStore = new FileAppendOnlyStore(@"C:\Users\wydev\Documents\GitHub\Clones\lokad-iddd-sample\DomainTests\Store\");
            var eventStore  = new EventStore(appendStore);
            var publisher   = new DomainEventPublisher(eventStore, 0, 500);
            var store       = new FileDocumentReaderWriter <CustomerId, CustomerTransactions>(@"C:\Users\wydev\Documents\GitHub\Clones\lokad-iddd-sample\DomainTests\Store\",
                                                                                              new ViewStrategy(@"C:\Users\wydev\Documents\GitHub\Clones\lokad-iddd-sample\DomainTests\Views\"));
            IDocumentWriter <CustomerId, CustomerTransactions> writer = store;

            var projection = new CustomerTransactionsProjection(writer);

            publisher.RegisterProjection(projection);
            var id     = new CustomerId(2);
            var @event = new CustomerCreated
            {
                Id       = id,
                Name     = "Microsoft",
                Currency = Currency.Eur
            };

            IList <IEvent> Changes = new List <IEvent>();

            Changes.Add(@event);

            eventStore.AppendToStream(id, 0, Changes);

            publisher.ProcessNewEvents();
        }
 public GraphQLController()
 {
     _executer           = new DocumentExecuter();
     _writer             = new DocumentWriter();
     _schema             = new TestSchema();
     _dataLoaderListener = new DataLoaderDocumentListener(new DataLoaderContextAccessor());
 }
示例#35
0
 public ClassBaseWriter(IDocumentWriter ownerDocument, IMemberWriter memberWriter,
     IBaseTypeMembersWriter baseTypeMembersWriter, ITypeNamesCache typeNamesCache)
 {
     this.ownerDocument = ownerDocument;
     this.memberWriter = memberWriter;
     this.baseTypeMembersWriter = baseTypeMembersWriter;
     this.typeNamesCache = typeNamesCache;
 }
示例#36
0
 public AppObjectWriter(IDocumentWriter ownerDocument, IInstanceRepository appObjectRepository,
     IValuesCache valuesCache, ITypeNamesCache typeNamesCache)
 {
     this.ownerDocument = ownerDocument;
     this.appObjectRepository = appObjectRepository;
     this.valuesCache = valuesCache;
     this.typeNamesCache = typeNamesCache;
 }
示例#37
0
 public DictionaryWriter(IDocumentWriter ownerDocument, IValuesCache valuesCache, IObjectWriter objectWriter,
     ITypeNamesCache typeNamesCache)
 {
     this.ownerDocument = ownerDocument;
     this.valuesCache = valuesCache;
     this.objectWriter = objectWriter;
     this.typeNamesCache = typeNamesCache;
 }
        protected override void SetUp()
        {
            base.SetUp();

            ownerDocument = NewMock<IDocumentWriter>();

            writer = new CustomTypeXmlWriter<Guid>(ownerDocument, "myType");
        }
        protected override void SetUp()
        {
            base.SetUp();

            ownerDocument = NewMock<IDocumentWriter>();
            objectWriter = NewMock<IObjectWriter>();

            writer = GetWriter();
        }
        protected override void SetUp()
        {
            base.SetUp();

            valuesCache = NewMock<IValuesCache>();
            document = NewMock<IDocumentWriter>();

            writer = new ObjectReferenceWriter(document, valuesCache);
        }
示例#41
0
        protected override void SetUp()
        {
            base.SetUp();

            ownerDocument = NewMock<IDocumentWriter>();
            objectWriter = NewMock<IObjectWriter>();

            writer = new MemberWriter(ownerDocument, objectWriter);
        }
示例#42
0
 public ListWriter(Type listType, IDocumentWriter ownerDocument, IValuesCache valuesCache,
     IObjectWriter objectWriter, ITypeNamesCache typeNamesCache)
 {
     this.listType = listType;
     this.ownerDocument = ownerDocument;
     this.valuesCache = valuesCache;
     this.objectWriter = objectWriter;
     this.typeNamesCache = typeNamesCache;
 }
示例#43
0
 protected static void HandleAtomic(AtomicMessage msg, SimpleMessageSender sender, IDocumentWriter<unit, int> arg3)
 {
     var count = arg3.AddOrUpdate(unit.it, () => 1, i => i + 1);
     if (count > 2)
     {
         sender.SendBatch(new object[] {}, e => e.AddString("ok"));
         return;
     }
     sender.SendOne(new AtomicMessage());
 }
        public DefaultValueWriterFactory(IDocumentWriter document, IApplicationObjectsRepository repository,
            ITypeNamesCache typeNamesCache)
        {
            this.document = document;
            this.repository = repository;
            this.typeNamesCache = typeNamesCache;

            if (repository == null)
            {
                this.repository = new NullApplicationObjectRepository();
            }
        }
        public void SetUp()
        {
            BsonClassMapHelper.Clear();

            var config = new DocumentStoreTestConfiguration();
            MongoDbTestConnectionProvider.DropTestsTenant();
            config.SetTestAddress(TestConfig.ServerAddress);
            _documentStoreService = new DocumentStoreBootstrapper();
            _documentStoreService.Start(config);

            TenantContext.Enter(new TenantId(TestConfig.Tenant));
            var tenant = ContainerAccessor.Instance.Resolve<TenantManager>().Current;
            _writer = tenant.Container.Resolve<IDocumentWriter>();
        }
 public EventStoreToQueueDistributor(
     string queueName,
     IQueueFactory queueFactory,
     IEventStore eventStore,
     IDocumentStore projectionStore,
     ISerializer serializer)
 {
     _markerReader = projectionStore.GetReader<string, EventStoreMarker>();
     _markerWriter = projectionStore.GetWriter<string, EventStoreMarker>();
     _queueName = queueName;
     _eventStore = eventStore;
     _queueWriter = queueFactory.CreateWriter(queueName);
     _serializer = new QueueMessageSerializer(serializer);
 }
        public GraphQLController(
            IDocumentExecuter executer,
            IDocumentWriter writer,
            StarWarsSchema schema)
        {
            _executer = executer;
            _writer = writer;
            _schema = schema;

            _namedQueries = new Dictionary<string, string>
            {
                ["a-query"] = @"query foo { hero { name } }"
            };
        }
示例#48
0
        private static void bulkTransfer(IDocumentReader reader, IDocumentWriter writer)
        {
            using (reader)
            {
                using (writer)
                {
                    writer.Schema = reader.Schema;

                    while (reader.Read())
                    {
                        var doc = reader.Current;
                        writer.Write(doc);
                    }
                }
            }
        }
        public void SetUp()
        {
            var config = new DocumentStoreTestConfiguration();
            MongoDbTestConnectionProvider.DropTestsTenant();
            config.SetTestAddress(TestConfig.ServerAddress);
            _documentStoreService = new DocumentStoreBootstrapper();
            _documentStoreService.Start(config);

            TenantContext.Enter(new TenantId(TestConfig.Tenant));
            var tenant = ContainerAccessor.Instance.Resolve<TenantManager>().Current;
            _bus = tenant.Container.Resolve<ICommandBus>();
            _filestore = tenant.Container.Resolve<IBlobStore>();
            Assert.IsTrue(_bus is IInProcessCommandBus);
            _projections = tenant.Container.Resolve<ITriggerProjectionsUpdate>();
            _handleWriter = tenant.Container.Resolve<IDocumentWriter>();
            _documentReader = tenant.Container.Resolve<IReader<DocumentDescriptorReadModel, DocumentDescriptorId>>();
        }
        public void SetUp()
        {
            BlobStore = Substitute.For<IBlobStore>();
            IdentityGenerator = Substitute.For<IIdentityGenerator>();
            _handleWriter = Substitute.For<IDocumentWriter>();
            DocumentReader = Substitute.For<IMongoDbReader<DocumentDescriptorReadModel, DocumentDescriptorId>>();
            DocumentDeletedReader = Substitute.For<IMongoDbReader<DocumentDeletedReadModel, String>>();

            QueueDispatcher = Substitute.For<IQueueManager>();
            CounterService = Substitute.For<ICounterService>();
            var bus = Substitute.For<IInProcessCommandBus>();
            var configuration =  new DocumentStoreTestConfiguration();
            Controller = new DocumentsController(
                BlobStore,
               configuration, 
                IdentityGenerator, 
                DocumentReader,
                DocumentDeletedReader,
                bus, 
                _handleWriter,
                QueueDispatcher,
                CounterService,
                null)
            {
                Request = new HttpRequestMessage
                {
                    RequestUri = new Uri("http://localhost/api/products")
                },
                Logger = new ConsoleLogger(),
                Configuration = new HttpConfiguration(),
                RequestContext =
                {
                    RouteData = new HttpRouteData(
                        route: new HttpRoute(),
                        values: new HttpRouteValueDictionary {{"controller", "file"}})
                }
            };

            //  Controller.Configuration.MapHttpAttributeRoutes();

            Controller.Request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration());
        }
        public void SetUp()
        {
            _collectionWrapper = Substitute.For<ICollectionWrapper<StreamReadModel, Int64>>();
            rmStream = new List<StreamReadModel>();
            rmDocuments = new List<DocumentDescriptorReadModel>();

            _collectionWrapper.When(r => r.Insert(
                Arg.Any<DomainEvent>(),
                Arg.Any<StreamReadModel>()))
                .Do(cinfo => rmStream.Add((StreamReadModel)cinfo.Args()[1]));
            _collectionWrapper.All.Returns(rmStream.AsQueryable());

            _readerDocumentReadModel = Substitute.For<IReader<DocumentDescriptorReadModel, DocumentDescriptorId>>();
            _readerDocumentReadModel.AllUnsorted.Returns(rmDocuments.AsQueryable());
            _readerDocumentReadModel.AllSortedById.Returns(rmDocuments.AsQueryable().OrderBy(r => r.Id));
            _readerDocumentReadModel.FindOneById(Arg.Any<DocumentDescriptorId>())
                .Returns(cinfo => rmDocuments.SingleOrDefault(d => d.Id == (DocumentDescriptorId)cinfo.Args()[0]));

            _handleWriter = Substitute.For<IDocumentWriter>();
            _blobStore = Substitute.For<IBlobStore>();
        }
示例#52
0
        public NXmlWriter(IDocumentWriter document, IApplicationObjectsRepository appObjectRepository,
            IMigrationRulesBuilder migrationRulesBuilder, ISubsystemBuilder pluginsBuilder)
        {
            system = new SystemDefinition();

            system.HasInstance(document)
                .Provides<IDocumentWriter>();

            system.HasInstance(appObjectRepository ?? new NullApplicationObjectRepository())
                .Provides<IApplicationObjectsRepository>();

            system.HasInstance(migrationRulesBuilder ?? new NullMigrationRulesBuilder())
                .Provides<IMigrationRulesBuilder>();

            system.HasInstance(new NullLogger())
                .Provides<ILogger>();

            if (pluginsBuilder != null)
            {
                system = system.CreateSubsystem(pluginsBuilder);
            }
        }
 public DocumentsController(
     IBlobStore blobStore,
     DocumentStoreConfiguration configService,
     IIdentityGenerator identityGenerator,
     IMongoDbReader<DocumentDescriptorReadModel, DocumentDescriptorId> documentDescriptorReader,
     IMongoDbReader<DocumentDeletedReadModel, String> documentDeletedReader,
     IInProcessCommandBus commandBus,
     IDocumentWriter handleWriter,
     IQueueManager queueDispatcher,
     ICounterService counterService,
     IDocumentFormatTranslator documentFormatTranslator)
 {
     _blobStore = blobStore;
     _configService = configService;
     _identityGenerator = identityGenerator;
     _documentDescriptorReader = documentDescriptorReader;
     _documentDeletedReader = documentDeletedReader;
     _handleWriter = handleWriter;
     _queueDispatcher = queueDispatcher;
     _counterService = counterService;
     _documentFormatTranslator = documentFormatTranslator;
     CommandBus = commandBus;
 }
        public void IdentifiesR2AsTheHero(IDocumentBuilder builder, IDocumentWriter writer)
        {
            // Assign
            var query = @"
                query HeroNameQuery {
                    hero {
                        name
                    }
                }
            ";
            var expected =
            @"{
            hero: {
            name: 'R2-D2'
            }
            }";
            // Act
            var doc = builder.Build(query);
            var result = writer.Write(doc);

            // Assert
            result.ShouldEqual(expected);
        }
示例#55
0
        protected override void SetUp()
        {
            document = NewMock<IDocumentWriter>();
            cache = NewMock<IValuesCache>();
            memberWriter = NewMock<IMemberWriter>();
            baseTypeMembersWriter = NewMock<IBaseTypeMembersWriter>();
            typeNamesCache = NewMock<ITypeNamesCache>();

            writer = new ClassWriter(document, cache, memberWriter, baseTypeMembersWriter, typeNamesCache);
        }
示例#56
0
 public LoginsIndexProjection(IDocumentWriter<unit, LoginsIndexView> writer)
 {
     _writer = writer;
 }
        protected override void SetUp()
        {
            base.SetUp();

            ownerDocument = NewMock<IDocumentWriter>();
            valueCache = NewMock<IValuesCache>();
            objectWriter = NewMock<IObjectWriter>();
            typeNamesCache = NewMock<ITypeNamesCache>();

            writer = new ArrayOfObjectsWriter(ownerDocument, valueCache, objectWriter, typeNamesCache);
        }
 public UserGoalsProjection(IDocumentWriter<string, UserGoalsView> writer)
 {
     _writer = writer;
 }
 public FormDefaultValuesProjection(IDocumentStore store)
 {
     _writer = store.GetWriter<Guid, FormDefaultValues>();
 }
        protected override void SetUp()
        {
            base.SetUp();

            ownerDocument = NewMock<IDocumentWriter>();

            writer = new PrimitiveValueTypeXmlWriter(ownerDocument);
        }