public void SetReferences(IReferences references)
        {
            _dependencyResolver.SetReferences(references);

            ReadPersistence  = _dependencyResolver.GetOneRequired <ILoggingPersistence>("read_persistence");
            WritePersistence = _dependencyResolver.GetOneOptional <ILoggingPersistence>("write_persistence");
        }
        protected override void Initialize()
        {
            Model = new TestModel();

            _moqLoggingController = new Mock <ILoggingController>();
            _loggingController    = _moqLoggingController.Object;

            _moqLoggingController.Setup(c => c.GetCommandSet()).Returns(new LoggingCommandSet(_loggingController));

            _moqLoggingPersistence = new Mock <ILoggingPersistence>();
            _loggingPersistence    = _moqLoggingPersistence.Object;

            _service = new LoggingHttpServiceV1();
            _service.Configure(_restConfig);

            var references = References.FromTuples(
                new Descriptor("pip-services-logging", "persistence", "memory", "default", "1.0"), _loggingPersistence,
                new Descriptor("pip-services-logging", "controller", "default", "default", "1.0"), _loggingController,
                new Descriptor("pip-services-logging", "service", "http", "default", "1.0"), _service
                );

            _service.SetReferences(references);

            Task.Run(() => _service.OpenAsync(Model.CorrelationId));
            Thread.Sleep(1000); // Just let service a sec to be initialized
        }
        private void CreateTestLogMessages(ILoggingPersistence loggingMemoryPersistence)
        {
            loggingMemoryPersistence.CreateAsync(Model.CorrelationId, Model.SampleMessage1).Wait();
            loggingMemoryPersistence.CreateAsync(Model.CorrelationId, Model.SampleMessage2).Wait();
            loggingMemoryPersistence.CreateAsync(Model.CorrelationId, Model.SampleMessage3).Wait();

            loggingMemoryPersistence.CreateAsync(Model.CorrelationId, Model.SampleErrorMessage1).Wait();
            loggingMemoryPersistence.CreateAsync(Model.CorrelationId, Model.SampleErrorMessage2).Wait();
            loggingMemoryPersistence.CreateAsync(Model.CorrelationId, Model.SampleErrorMessage3).Wait();
        }
예제 #4
0
        protected override void Initialize()
        {
            Model = new TestModel();

            var references = new References();

            _loggingController = new LoggingController();

            _moqLoggingPersistence = new Mock <ILoggingPersistence>();
            _loggingPersistence    = _moqLoggingPersistence.Object;

            references.Put(new Descriptor("pip-services-logging", "persistence", "memory", "default", "1.0"), _loggingPersistence);
            references.Put(new Descriptor("pip-services-logging", "controller", "default", "default", "1.0"), _loggingController);

            _loggingController.SetReferences(references);
        }