Пример #1
1
        public Connection(IMessageBus newMessageBus,
                          JsonSerializer jsonSerializer,
                          string baseSignal,
                          string connectionId,
                          IList<string> signals,
                          IList<string> groups,
                          ILoggerFactory loggerFactory,
                          IAckHandler ackHandler,
                          IPerformanceCounterManager performanceCounterManager,
                          IProtectedData protectedData,
                          IMemoryPool pool)
        {
            if (loggerFactory == null)
            {
                throw new ArgumentNullException("loggerFactory");
            }

            _bus = newMessageBus;
            _serializer = jsonSerializer;
            _baseSignal = baseSignal;
            _connectionId = connectionId;
            _signals = new List<string>(signals.Concat(groups));
            _groups = new DiffSet<string>(groups);
            _logger = loggerFactory.CreateLogger<Connection>();
            _ackHandler = ackHandler;
            _counters = performanceCounterManager;
            _protectedData = protectedData;
            _excludeMessage = m => ExcludeMessage(m);
            _pool = pool;
        }
Пример #2
1
        public Connection(IMessageBus newMessageBus,
                          IJsonSerializer jsonSerializer,
                          string baseSignal,
                          string connectionId,
                          IList<string> signals,
                          IList<string> groups,
                          ITraceManager traceManager,
                          IAckHandler ackHandler,
                          IPerformanceCounterManager performanceCounterManager,
                          IProtectedData protectedData)
        {
            if (traceManager == null)
            {
                throw new ArgumentNullException("traceManager");
            }

            _bus = newMessageBus;
            _serializer = jsonSerializer;
            _baseSignal = baseSignal;
            _connectionId = connectionId;
            _signals = new List<string>(signals.Concat(groups));
            _groups = new DiffSet<string>(groups);
            _traceSource = traceManager["SignalR.Connection"];
            _ackHandler = ackHandler;
            _counters = performanceCounterManager;
            _protectedData = protectedData;
        }
 public SetLocationFromGeoWorkItemHandler(ICacheClient cacheClient, IEventRepository eventRepository, IGeocodeService geocodeService, IMetricsClient metricsClient, IMessageBus messageBus, ILoggerFactory loggerFactory = null) : base(loggerFactory) {
     _cacheClient = new ScopedCacheClient(cacheClient, "geo");
     _eventRepository = eventRepository;
     _geocodeService = geocodeService;
     _metricsClient = metricsClient;
     _lockProvider = new CacheLockProvider(cacheClient, messageBus);
 }
Пример #4
0
        public SessionHandler(ILogger<SessionHandler> logger,
            IEnvironment environment,
            IFileSystem fileSystem,
            IKeyValueStore keyValueStore,
            IMessageBus messageBus,
            ISession session,
            ITorrentInfoRepository torrentInfoRepository,
            ITorrentMetadataRepository metadataRepository)
        {
            if (logger == null) throw new ArgumentNullException("logger");
            if (environment == null) throw new ArgumentNullException("environment");
            if (fileSystem == null) throw new ArgumentNullException("fileSystem");
            if (keyValueStore == null) throw new ArgumentNullException("keyValueStore");
            if (messageBus == null) throw new ArgumentNullException("messageBus");
            if (session == null) throw new ArgumentNullException("session");
            if (torrentInfoRepository == null) throw new ArgumentNullException("torrentInfoRepository");
            if (metadataRepository == null) throw new ArgumentNullException("metadataRepository");

            _logger = logger;
            _environment = environment;
            _fileSystem = fileSystem;
            _keyValueStore = keyValueStore;
            _messageBus = messageBus;
            _session = session;
            _torrentInfoRepository = torrentInfoRepository;
            _metadataRepository = metadataRepository;
            _muted = new List<string>();
            _alertsThread = new Thread(ReadAlerts);
        }
Пример #5
0
 public void Register(IMessageBus bus)
 {
     // Listen for the message which has us navigate.
     bus.Listen<NavigateMessage>()
        .ObserveOn(RxApp.DeferredScheduler)
        .Subscribe(OnNavigateMessage);
 }
Пример #6
0
        public NUnitTestRunner(IMessageBus bus, IConfiguration configuration, IAssemblyReader assemblyReader, IFileSystemService fsService)
        {
            _bus = bus;
            _configuration = configuration;
			_assemblyReader = assemblyReader;
            _fsService = fsService;
        }
Пример #7
0
 public PhysicsEngine(IMessageBus bus, IObservableTimer timer,IGameObjectFactory gameObjectFactory)
 {
     Timer = timer;
     Bus = bus;
     Running = false;
     _gameObjectFactory = gameObjectFactory;
 }
Пример #8
0
        public LoanViewModel(IMessageBus messenger, Loan loan)
        {
            myLoan = loan;
            _OweTo = myLoan.Lender.Name;
            _APR = myLoan.APR;
            _OutstandingBalance = myLoan.OutstandingBalance(DateTime.Now);

            _MakePaymentCommand = new DelegateCommand(MakePaymentExecute, MakePaymentCanExecute);

            myMessenger = messenger;
            myMessenger
                .Listen<Loan>("PaymentMade")
                .ObserveOnDispatcher()
                .Subscribe(
                    l =>
                    {
                        if (l == myLoan)
                        {
                            myMessenger.SendMessage<Person>(loan.Lender, "BalanceChanged");
                            myMessenger.SendMessage<Person>(loan.Borrower, "BalanceChanged");
                            this.PaymentMaker = null;
                            this.OutstandingBalance = myLoan.OutstandingBalance(DateTime.Now);
                        }
                    });
        }
        public void SetUp()
        {
            _project = new Project(Path.GetFullPath("someProject.csproj"), new ProjectDocument(ProjectType.CSharp));
			_project.Value.SetOutputPath("");
			_project.Value.SetAssemblyName("someAssembly.dll");
            _bus = MockRepository.GenerateMock<IMessageBus>();
            _listGenerator = MockRepository.GenerateMock<IGenerateBuildList>();
            _configuration = MockRepository.GenerateMock<IConfiguration>();
            _buildRunner = MockRepository.GenerateMock<IBuildRunner>();
            _testRunner = MockRepository.GenerateMock<ITestRunner>();
			_testAssemblyValidator = MockRepository.GenerateMock<IDetermineIfAssemblyShouldBeTested>();
			_optimizer = MockRepository.GenerateMock<IOptimizeBuildConfiguration>();
			_runInfo = new RunInfo(_project);
			_runInfo.ShouldBuild();
			_runInfo.SetAssembly(_project.Value.AssemblyName);
			_optimizer.Stub(o => o.AssembleBuildConfiguration(new string[] {})).IgnoreArguments().Return(new RunInfo[] { _runInfo });
            _preProcessor = MockRepository.GenerateMock<IPreProcessTestruns>();
            _preProcessor.Stub(x => x.PreProcess(null)).IgnoreArguments().Return(new RunInfo[] { _runInfo });
            var preProcessors = new IPreProcessTestruns[] { _preProcessor };
            var buildPreProcessor = MockRepository.GenerateMock<IPreProcessBuildruns>();
            buildPreProcessor.Stub(x => x.PreProcess(null)).IgnoreArguments().Return(new RunInfo[] { _runInfo });
            var buildPreProcessors = new IPreProcessBuildruns[] { buildPreProcessor };
            _removedTestLocator = MockRepository.GenerateMock<ILocateRemovedTests>();
            _consumer = new ProjectChangeConsumer(_bus, _listGenerator, _configuration, _buildRunner, new ITestRunner[] { _testRunner }, _testAssemblyValidator, _optimizer, preProcessors, _removedTestLocator, buildPreProcessors);
        }
Пример #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AccountController"/> class.
 /// </summary>
 /// <param name="userService">The user service.</param>
 /// <param name="authenticationService">The authentication service.</param>
 /// <param name="messageBus">The message bus.</param>
 /// <param name="membershipSettings"></param>
 public AccountController(IUserAccountService userService, IAuthenticationService authenticationService, IMessageBus messageBus, IMembershipSettings membershipSettings)
 {
     _membershipSettings = membershipSettings;
     _messageBus = messageBus;
     _userService = userService;
     _authenticationService = authenticationService;
 }
Пример #11
0
        public ModuleLoader(IMessageBus bus, IWindsorContainer windsorContainer)
        {
            _bus = bus;
            _windsorContainer = windsorContainer;

            _bus.Listen<ApplicationLoadedMessage>().ObserveOn(Scheduler.ThreadPool).Subscribe(OnApplicationLoaded);
        }
Пример #12
0
        public void setUp()
        {
			_bus = MockRepository.GenerateMock<IMessageBus>();
            _fsService = new FakeFileSystemService();
            _cache = new FakeCache();
            _crawler = new ProjectCrawler(_cache, _fsService, _bus);
        }
Пример #13
0
        public void SetUp()
        {
            _bus = MockRepository.GenerateMock<IMessageBus>();
            _configuration = MockRepository.GenerateMock<IConfiguration>();
			_referenceResolver = MockRepository.GenerateMock<IResolveAssemblyReferences>();
            _runner = new NUnitTestRunner(_bus, _configuration, _referenceResolver);
        }
        public OrganisationsController(
            IMessageBus messageBus,
            IUserContext userContext,
            IOrganisationViewModelQuery organisationViewModelQuery,
            IActivityViewModelQuery activityViewModelQuery,
            IPostViewModelQuery postViewModelQuery,
            IUserViewModelQuery userViewModelQuery,
            IPermissionManager permissionManager,
            IDocumentSession documentSession
            )
        {
            Check.RequireNotNull(messageBus, "messageBus");
            Check.RequireNotNull(userContext, "userContext");
            Check.RequireNotNull(organisationViewModelQuery, "organisationViewModelQuery");
            Check.RequireNotNull(activityViewModelQuery, "activityViewModelQuery");
            Check.RequireNotNull(postViewModelQuery, "postViewModelQuery");
            Check.RequireNotNull(userViewModelQuery, "userViewModelQuery");
            Check.RequireNotNull(permissionManager, "permissionManager");
            Check.RequireNotNull(documentSession, "documentSession");

            _messageBus = messageBus;
            _userContext = userContext;
            _organisationViewModelQuery = organisationViewModelQuery;
            _activityViewModelQuery = activityViewModelQuery;
            _postViewModelQuery = postViewModelQuery;
            _userViewModelQuery = userViewModelQuery;
            _permissionManager = permissionManager;
            _documentSession = documentSession;
        }
Пример #15
0
 /// <inheritdoc/>
 public override Task<RunSummary> RunAsync(IMessageBus messageBus,
                                           object[] constructorArguments,
                                           ExceptionAggregator aggregator,
                                           CancellationTokenSource cancellationTokenSource)
 {
     return new LambdaTestCaseRunner(this, messageBus, aggregator, cancellationTokenSource).RunAsync();
 }
Пример #16
0
        public static void Main() {
            log4net.Config.XmlConfigurator.Configure();

            var container = new Container(i => {
            });

            var messageBus = MessageBusBuilder.Initialize(builder => {
                builder.ServiceLocator = new StructureMapServiceLocator(container);
                builder.MessageTypeConventions.AddConvention(t => t.Namespace == "MyMessages");
                builder.AddAssembliesToScan(Assembly.Load("MyMessages"));
                builder.UseServiceBrokerTransport(t => {
                    t.ListenerQueue = "CWServiceBus_Samples_PubSub_Publisher";
                    t.ReturnAddress = "[//CWServiceBus/Samples/PubSub/Publisher]";
                    t.NumberOfWorkerThreads = 1;
                    t.ServiceBrokerConnectionString = "Data Source=localhost;Initial Catalog=ServiceBus;Trusted_Connection=true";
                });
                builder.SubscriptionStorage = new CWServiceBus.Unicast.Sql.SqlServerSubscriptionStorage()
                {
                    ConnectionString = "Data Source=localhost;Initial Catalog=ServiceBus;Trusted_Connection=true",
                };
            });

            messageBus.Start();
            MessageBus = messageBus;

            Run();
        }
Пример #17
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public ActiveClient(ClientId id)
        {
            _id = id;

            _executionStrategy = null;
            _messageBus = null;
        }
    /// <summary>
    /// Creates an instance of the test class for the given test case. Sends the <see cref="ITestClassConstructionStarting"/>
    /// and <see cref="ITestClassConstructionFinished"/> messages as appropriate.
    /// </summary>
    /// <param name="testCase">The test case</param>
    /// <param name="testClassType">The type of the test class</param>
    /// <param name="constructorArguments">The constructor arguments for the test class</param>
    /// <param name="displayName">The display name of the test case</param>
    /// <param name="messageBus">The message bus used to send the test messages</param>
    /// <param name="timer">The timer used to measure the time taken for construction</param>
    /// <param name="cancellationTokenSource">The cancellation token source</param>
    /// <returns></returns>
    public static object CreateTestClass(this ITestCase testCase,
                                         Type testClassType,
                                         object[] constructorArguments,
                                         string displayName,
                                         IMessageBus messageBus,
                                         ExecutionTimer timer,
                                         CancellationTokenSource cancellationTokenSource)
    {
        object testClass = null;

        if (!messageBus.QueueMessage(new TestClassConstructionStarting(testCase, displayName)))
            cancellationTokenSource.Cancel();

        try
        {
            if (!cancellationTokenSource.IsCancellationRequested)
                timer.Aggregate(() => testClass = Activator.CreateInstance(testClassType, constructorArguments));
        }
        finally
        {
            if (!messageBus.QueueMessage(new TestClassConstructionFinished(testCase, displayName)))
                cancellationTokenSource.Cancel();
        }

        return testClass;
    }
Пример #19
0
        /// <inheritdoc/>
        protected override Task RunTestsAsync(IMessageBus messageBus, object[] constructorArguments, ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource)
        {
            if (!messageBus.QueueMessage(new TestStarting(this, DisplayName)))
                cancellationTokenSource.Cancel();
            else
            {
                try
                {
                    lambda();

                    if (!messageBus.QueueMessage(new TestPassed(this, DisplayName, 0, null)))
                        cancellationTokenSource.Cancel();
                }
                catch (Exception ex)
                {
                    if (!messageBus.QueueMessage(new TestFailed(this, DisplayName, 0, null, ex)))
                        cancellationTokenSource.Cancel();
                }
            }

            if (!messageBus.QueueMessage(new TestFinished(this, DisplayName, 0, null)))
                cancellationTokenSource.Cancel();

            return Task.FromResult(0);
        }
Пример #20
0
        public ScenarioRunner(
            IScenario scenario,
            IMessageBus messageBus,
            Type scenarioClass,
            object[] constructorArguments,
            MethodInfo scenarioMethod,
            object[] scenarioMethodArguments,
            string skipReason,
            IReadOnlyList<BeforeAfterTestAttribute> beforeAfterScenarioAttributes,
            ExceptionAggregator aggregator,
            CancellationTokenSource cancellationTokenSource)
        {
            Guard.AgainstNullArgument("scenario", scenario);
            Guard.AgainstNullArgument("messageBus", messageBus);
            Guard.AgainstNullArgument("aggregator", aggregator);

            this.scenario = scenario;
            this.messageBus = messageBus;
            this.scenarioClass = scenarioClass;
            this.constructorArguments = constructorArguments;
            this.scenarioMethod = scenarioMethod;
            this.scenarioMethodArguments = scenarioMethodArguments;
            this.skipReason = skipReason;
            this.beforeAfterScenarioAttributes = beforeAfterScenarioAttributes;
            this.parentAggregator = aggregator;
            this.cancellationTokenSource = cancellationTokenSource;
        }
		public void SetUp()
		{
			_bus = MockRepository.GenerateMock<IMessageBus>();
			_assemblyIdProvider = MockRepository.GenerateMock<IRetrieveAssemblyIdentifiers>();
			_consumer = new BinaryFileChangeConsumer(_bus, _assemblyIdProvider);
			_files = new FileChangeMessage();
		}
Пример #22
0
        protected override IMessageBus GetMessageBus() {
            if (_messageBus != null)
                return _messageBus;

            _messageBus = new InMemoryMessageBus(Log);
            return _messageBus;
        }
        /// <summary>
        /// Finds the tests on a test method.
        /// </summary>
        /// <param name="testMethod">The test method.</param>
        /// <param name="includeSourceInformation">Set to <c>true</c> to indicate that source information should be included.</param>
        /// <param name="messageBus">The message bus to report discovery messages to.</param>
        /// <param name="discoveryOptions">The options used by the test framework during discovery.</param>
        /// <returns>Return <c>true</c> to continue test discovery, <c>false</c>, otherwise.</returns>
        protected virtual bool FindTestsForMethod(ITestMethod testMethod, bool includeSourceInformation, IMessageBus messageBus, ITestFrameworkDiscoveryOptions discoveryOptions)
        {
            var factAttributes = testMethod.Method.GetCustomAttributes(typeof(FactAttribute)).CastOrToList();
            if (factAttributes.Count > 1)
            {
                var message = string.Format("Test method '{0}.{1}' has multiple [Fact]-derived attributes", testMethod.TestClass.Class.Name, testMethod.Method.Name);
                var testCase = new ExecutionErrorTestCase(DiagnosticMessageSink, TestMethodDisplay.ClassAndMethod, testMethod, message);
                return ReportDiscoveredTestCase(testCase, includeSourceInformation, messageBus);
            }

            var factAttribute = factAttributes.FirstOrDefault();
            if (factAttribute == null)
                return true;

            var testCaseDiscovererAttribute = factAttribute.GetCustomAttributes(typeof(XunitTestCaseDiscovererAttribute)).FirstOrDefault();
            if (testCaseDiscovererAttribute == null)
                return true;

            var args = testCaseDiscovererAttribute.GetConstructorArguments().Cast<string>().ToList();
            var discovererType = SerializationHelper.GetType(args[1], args[0]);
            if (discovererType == null)
                return true;

            var discoverer = GetDiscoverer(discovererType);
            if (discoverer == null)
                return true;

            foreach (var testCase in discoverer.Discover(discoveryOptions, testMethod, factAttribute))
                if (!ReportDiscoveredTestCase(testCase, includeSourceInformation, messageBus))
                    return false;

            return true;
        }
Пример #24
0
 void Start ()
 {
     _messageBus = ApplicationManager.Instance.GetService<IMessageBus>();
     ListenMainMenu();
     ListenAddMenu();
     ListenEditMenu();
 }
Пример #25
0
 public ChangeTracker(RealtimeChangePreProcessor preProcessor, IConfiguration configuration, IMessageBus bus, IGenerateBuildList listGenerator)
 {
     _preProcessor = preProcessor;
     _configuration = configuration;
     _bus = bus;
     _listGenerator = listGenerator;
 }
Пример #26
0
 protected AwesomiumGUI(IAssets assets,IMessageBus bus,IObservableTimer timer )
 {
     Assets = assets;
     Bus = bus;
     Timer = timer;
     WebCore.Initialize(new WebCoreConfig { CustomCSS = "::-webkit-scrollbar { visibility: hidden; }" });
 }
        /// <summary>
        /// Finds the tests on a test method.
        /// </summary>
        /// <param name="testMethod">The test method.</param>
        /// <param name="includeSourceInformation">Set to <c>true</c> to indicate that source information should be included.</param>
        /// <param name="messageBus">The message bus to report discovery messages to.</param>
        /// <param name="discoveryOptions">The options used by the test framework during discovery.</param>
        /// <returns>Return <c>true</c> to continue test discovery, <c>false</c>, otherwise.</returns>
        protected virtual bool FindTestsForMethod(ITestMethod testMethod, bool includeSourceInformation, IMessageBus messageBus, ITestFrameworkDiscoveryOptions discoveryOptions)
        {
            var factAttribute = testMethod.Method.GetCustomAttributes(typeof(FactAttribute)).FirstOrDefault();
            if (factAttribute == null)
                return true;

            var testCaseDiscovererAttribute = factAttribute.GetCustomAttributes(typeof(XunitTestCaseDiscovererAttribute)).FirstOrDefault();
            if (testCaseDiscovererAttribute == null)
                return true;

            var args = testCaseDiscovererAttribute.GetConstructorArguments().Cast<string>().ToList();
            var discovererType = SerializationHelper.GetType(args[1], args[0]);
            if (discovererType == null)
                return true;

            var discoverer = GetDiscoverer(discovererType);
            if (discoverer == null)
                return true;

            foreach (var testCase in discoverer.Discover(discoveryOptions, testMethod, factAttribute))
                if (!ReportDiscoveredTestCase(testCase, includeSourceInformation, messageBus))
                    return false;

            return true;
        }
Пример #28
0
 public void testSetup()
 {
     _services = MockRepository.GenerateMock<IServiceLocator>();
     _cache = MockRepository.GenerateMock<ICache>();
     _bus = MockRepository.GenerateMock<IMessageBus>();
     _subject = new FileChangeConsumer(_services, _bus, _cache);
 }
Пример #29
0
        public UsersController(
            IMessageBus messageBus,
            IUserContext userContext,
            IProjectViewModelQuery projectViewModelQuery,
            ISightingViewModelQuery sightingViewModelQuery,
            IActivityViewModelQuery activityViewModelQuery,
            IPostViewModelQuery postViewModelQuery,
            IUserViewModelQuery userViewModelQuery,
            IPermissionManager permissionManager,
            IDocumentSession documentSession
            )
        {
            Check.RequireNotNull(messageBus, "messageBus");
            Check.RequireNotNull(userContext, "userContext");
            Check.RequireNotNull(projectViewModelQuery, "projectViewModelQuery");
            Check.RequireNotNull(sightingViewModelQuery, "sightingViewModelQuery");
            Check.RequireNotNull(activityViewModelQuery, "activityViewModelQuery");
            Check.RequireNotNull(postViewModelQuery, "postViewModelQuery");
            Check.RequireNotNull(userViewModelQuery, "userViewModelQuery");
            Check.RequireNotNull(permissionManager, "permissionManager");
            Check.RequireNotNull(documentSession, "documentSession");

            _messageBus = messageBus;
            _userContext = userContext;
            _projectViewModelQuery = projectViewModelQuery;
            _sightingViewModelQuery = sightingViewModelQuery;
            _activityViewModelQuery = activityViewModelQuery;
            _postViewModelQuery = postViewModelQuery;
            _userViewModelQuery = userViewModelQuery;
            _permissionManager = permissionManager;
            _documentSession = documentSession;
        }
Пример #30
0
        public LoanPaymentViewModel(IMessageBus messenger, Loan loan)
        {
            myLoan = loan;
            myMessenger = messenger;

            _MakePaymentCommand = new DelegateCommand(MakePaymentExecute, MakePaymentCanExecute);
        }
Пример #31
0
 /// <summary>
 /// Core implementation to discover unit tests in a given test class.
 /// </summary>
 /// <param name="testClass">The test class.</param>
 /// <param name="includeSourceInformation">Set to <c>true</c> to attempt to include source information.</param>
 /// <param name="messageBus">The message sink to send discovery messages to.</param>
 /// <param name="discoveryOptions">The options used by the test framework during discovery.</param>
 /// <returns>Returns <c>true</c> if discovery should continue; <c>false</c> otherwise.</returns>
 protected abstract bool FindTestsForType(ITestClass testClass, bool includeSourceInformation, IMessageBus messageBus, ITestFrameworkDiscoveryOptions discoveryOptions);
Пример #32
0
 public HelloPacketHandler(ILogger logger, IMessageBus messageBus)
 {
     this.logger     = logger;
     this.messageBus = messageBus;
 }
Пример #33
0
        /// <summary>
        /// Reports a discovered test case to the message bus, after updating the source code information
        /// (if desired).
        /// </summary>
        /// <param name="testCase"></param>
        /// <param name="includeSourceInformation"></param>
        /// <param name="messageBus"></param>
        /// <returns></returns>
        protected bool ReportDiscoveredTestCase(ITestCase testCase, bool includeSourceInformation, IMessageBus messageBus)
        {
            if (includeSourceInformation && SourceProvider != null)
            {
                testCase.SourceInformation = SourceProvider.GetSourceInformation(testCase);
            }

            return(messageBus.QueueMessage(new TestCaseDiscoveryMessage(testCase)));
        }
Пример #34
0
 public WorkItemJob(IQueue <WorkItemData> queue, IMessageBus messageBus, WorkItemHandlers handlers) : base(queue)
 {
     _messageBus  = messageBus;
     _handlers    = handlers;
     AutoComplete = true;
 }
Пример #35
0
 public static void PublishNamedMessage <T>(this IMessageBus msgBus, string name, T arg)
 => msgBus.Publish(new NamedMessage <T>(name, arg));
Пример #36
0
 public OrderController(IMessageBus messageBus)
 {
     _messageBus = messageBus;
 }
Пример #37
0
 // ReSharper disable once TooManyArguments
 protected override Task <RunSummary> RunTestCollectionAsync(IMessageBus messageBus,
                                                             ITestCollection testCollection,
                                                             IEnumerable <IXunitTestCase> testCases,
                                                             CancellationTokenSource cancellationTokenSource)
 => new TestCollectionRunner(testCollection, testCases, DiagnosticMessageSink, messageBus, TestCaseOrderer,
                             new ExceptionAggregator(Aggregator), cancellationTokenSource).RunAsync();
Пример #38
0
 public NotificationDelegate(SampleSqliteConnection conn, IMessageBus messageBus)
 {
     this.conn       = conn;
     this.messageBus = messageBus;
 }
Пример #39
0
 public override Task <RunSummary> RunAsync(IMessageSink diagnosticMessageSink, IMessageBus messageBus, object[] constructorArguments,
                                            ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource)
 {
     return(new ScenarioTestCaseRunner((IXunitTestCase)this, this.DisplayName, this.SkipReason, constructorArguments, this.TestMethodArguments, messageBus, aggregator, cancellationTokenSource).RunAsync());
 }
        public ExceptionlessElasticConfiguration(IOptions <ElasticsearchOptions> options, IOptions <AppOptions> appOptions, IQueue <WorkItemData> workItemQueue, ICacheClient cacheClient, IMessageBus messageBus, ILoggerFactory loggerFactory) : base(workItemQueue, cacheClient, messageBus, loggerFactory)
        {
            _options    = options;
            _appOptions = appOptions;

            _logger.LogInformation("All new indexes will be created with {ElasticsearchNumberOfShards} Shards and {ElasticsearchNumberOfReplicas} Replicas", options.Value.NumberOfShards, options.Value.NumberOfReplicas);
            AddIndex(Stacks        = new StackIndex(this));
            AddIndex(Events        = new EventIndex(this));
            AddIndex(Organizations = new OrganizationIndex(this));
        }
Пример #41
0
        public static void ConfigureComponents(this IConfigureComponents componentConfig, IMessageBus bus, IMessageBusConfiguration configuration)
        {
            var nsbHandlerType = typeof(NSBMessageHandler <,>);

            var handlers = configuration.MessageDefinitions
                           .Where(md => md.HandlerType != null)
                           .Select(md => nsbHandlerType.MakeGenericType(md.MessageType, md.HandlerType));

            foreach (var handler in handlers)
            {
                componentConfig.ConfigureComponent(handler, DependencyLifecycle.InstancePerCall).ConfigureProperty("Bus", bus);
            }
        }
Пример #42
0
 private bool FindTestsForTypeAndWrapExceptions(ITestClass testClass, bool includeSourceInformation, IMessageBus messageBus, ITestFrameworkDiscoveryOptions discoveryOptions)
 {
     try
     {
         return(FindTestsForType(testClass, includeSourceInformation, messageBus, discoveryOptions));
     }
     catch (Exception ex)
     {
         DiagnosticMessageSink.OnMessage(new DiagnosticMessage("Exception during discovery:{0}{1}", Environment.NewLine, ex));
         return(true); // Keep going on to the next type
     }
 }
Пример #43
0
 public OpenXamarinStudioCommand(ProjectWorkspace project, IMessageBus messaging, ToolboxSocket socket)
     : base(project, messaging, socket)
 {
     MenuText = "Open in Xamarin Studio";
 }
Пример #44
0
 public OutputMediator(IMessageBus asyncMessageBus)
 {
     _asyncMessageBus = asyncMessageBus;
 }
Пример #45
0
 public SagaController(IMessageBus bus)
 {
     _bus = bus ?? throw new ArgumentNullException(nameof(bus));
 }
Пример #46
0
 public PushManager(AzureNotificationConfig config,
                    AndroidContext context,
                    ISettings settings,
                    IMessageBus bus) : base(context, settings, bus)
Пример #47
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CustomLabelViewModel"/> class.
        /// </summary>
        /// <param name="source">The custom label.</param>
        /// <param name="dialogService">The dialog service.</param>
        /// <param name="audioSession">The audio session.</param>
        /// <param name="messageBus">The message bus.</param>
        public CustomLabelViewModel(CustomLabel source, IDialogService dialogService, IAudioSession audioSession, IMessageBus messageBus)
            : base(messageBus, source)
        {
            _source       = source;
            _audioSession = audioSession;
            _audioSession.PropertyChanged += AudioSessionOnPropertyChanged;

            DialogService = dialogService;
            TextSegments  = FormattedTextParser.ParseFormattedString(FormatString, Color, audioSession);
            IsPlaying     = _audioSession.IsPlaying;
        }
Пример #48
0
 public CacheLockProvider(ICacheClient cacheClient, IMessageBus messageBus, ILoggerFactory loggerFactory = null)
 {
     _logger      = loggerFactory?.CreateLogger <CacheLockProvider>() ?? NullLogger <CacheLockProvider> .Instance;
     _cacheClient = new ScopedCacheClient(cacheClient, "lock");
     _messageBus  = messageBus;
 }
Пример #49
0
 public void Awake()
 {
     defaultScale = transform.localScale;
     vent         = LocatorProvider.Get().Get(MaruKeys.Vent) as IMessageBus;
 }
            public static MultipleScenariosTestCaseRunnerMock Create(Type testClass, string testMethodName, ExceptionAggregator aggregator = null, IMessageBus bus = null)
            {
                var testCaseDiscoverer =
                    new ScenarioExpectationDiscovererTests.TestableScenarioExpectationDiscoverer(new NullMessageSink())
                {
                    PreEnumerateTestCases = false
                };

                var testMethod          = XunitMocks.TestMethod(testClass, testMethodName);
                var expectThatAttribute = XunitMocks.ExpectThatAttribute();
                var testCases           = testCaseDiscoverer.Discover(new TestFrameworkOptions(), testMethod, expectThatAttribute);
                var testCase            = testCases.SingleOrDefault() as MultipleScenariosTestCase;

                if (testCase == null)
                {
                    throw new NotSupportedException("Test case is not a MultipleScenariosTestCase");
                }

                var runner = new MultipleScenariosTestCaseRunnerMock(testCase,
                                                                     testCase.DisplayName,
                                                                     testCase.SkipReason,
                                                                     new object[0],
                                                                     new NullMessageSink(),
                                                                     bus,
                                                                     aggregator,
                                                                     new CancellationTokenSource()
                                                                     );

                return(runner);
            }
Пример #51
0
 public ProjectMaintenanceWorkItemHandler(IProjectRepository projectRepository, ICacheClient cacheClient, IMessageBus messageBus, ILoggerFactory loggerFactory = null) : base(loggerFactory)
 {
     _projectRepository = projectRepository;
     _lockProvider      = new CacheLockProvider(cacheClient, messageBus);
 }
 public DelayedMessageBus(IMessageBus messageBus)
 {
     this.messageBus = messageBus;
 }
Пример #53
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Xunit.Sdk.XunitTestCollectionRunner"/> class.
 /// </summary>
 /// <param name="testCollection">The test collection that contains the tests to be run.</param><param name="testCases">The test cases to be run.</param><param name="diagnosticMessageSink">The message sink used to send diagnostic messages</param><param name="messageBus">The message bus to report run status to.</param><param name="testCaseOrderer">The test case orderer that will be used to decide how to order the test.</param><param name="aggregator">The exception aggregator used to run code and collect exceptions.</param><param name="cancellationTokenSource">The task cancellation token source, used to cancel the test run.</param>
 public BrowserTestCollectionRunner(ITestCollection testCollection, IEnumerable <IXunitTestCase> testCases, IMessageSink diagnosticMessageSink, IMessageBus messageBus, ITestCaseOrderer testCaseOrderer, ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource)
     : base(testCollection, testCases, diagnosticMessageSink, messageBus, testCaseOrderer, aggregator, cancellationTokenSource)
 {
     DiagnosticMessageSink = diagnosticMessageSink;
 }
Пример #54
0
 /// <inheritdoc/>
 public virtual Task <RunSummary> RunAsync(IMessageSink diagnosticMessageSink,
                                           IMessageBus messageBus,
                                           object[] constructorArguments,
                                           ExceptionAggregator aggregator,
                                           CancellationTokenSource cancellationTokenSource)
 => new XunitTestCaseRunner(this, DisplayName, SkipReason, constructorArguments, TestMethodArguments, messageBus, aggregator, cancellationTokenSource).RunAsync();
        public void Initialize(IMessageBus messageBus)
        {
            _messageBus = messageBus;

            _messageBus.Register(this);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="AudioBandToolbarViewModel"/> class.
        /// </summary>
        /// <param name="viewModels">The view models.</param>
        /// <param name="appSettings">The app settings.</param>
        /// <param name="audioSourceManager">The audio source mananger.</param>
        /// <param name="messageBus">The message bus.</param>
        /// <param name="audioSession">The audio session.</param>
        public AudioBandToolbarViewModel(IViewModelContainer viewModels, IAppSettings appSettings, IAudioSourceManager audioSourceManager, IMessageBus messageBus, IAudioSession audioSession)
        {
            _appSettings        = appSettings;
            _audioSourceManager = audioSourceManager;
            _messageBus         = messageBus;
            _audioSession       = audioSession;
            ViewModels          = viewModels;

            ShowSettingsWindowCommand = new RelayCommand(ShowSettingsWindowCommandOnExecute);
            LoadCommand = new AsyncRelayCommand <object>(LoadCommandOnExecute);
            SelectAudioSourceCommand = new AsyncRelayCommand <IInternalAudioSource>(SelectAudioSourceCommandOnExecute);
        }
Пример #57
0
 /// <summary>
 /// Override the default Message Bus during the specified block.
 /// </summary>
 /// <param name="messageBus">The message bus to use for the block.</param>
 /// <param name="sched">The scheduler to use.</param>
 /// <param name="block">The action to execute.</param>
 public static void With(this IMessageBus messageBus, Action block)
 {
     using (messageBus.WithMessageBus()) {
         block();
     }
 }
Пример #58
0
 protected override Task <RunSummary> RunTestCollectionAsync(IMessageBus messageBus, ITestCollection testCollection, IEnumerable <IXunitTestCase> testCases, CancellationTokenSource cancellationTokenSource)
 {
     TestCasesRun.Add(Tuple.Create(Thread.CurrentThread.ManagedThreadId, testCases));
     Thread.Sleep(5); // Hold onto the worker thread long enough to ensure tests all get spread around
     return(Task.FromResult(new RunSummary()));
 }
Пример #59
0
 public static IObservable <Unit> NamedListener(this IMessageBus msgBus, string eventName) => msgBus
 .Listener <NamedMessage <Unit> >()
 .Where(x => x.Name.Equals(eventName))
 .Select(x => x.Arg);
Пример #60
0
 /// <summary>
 /// Override the default Message Bus during the specified block.
 /// </summary>
 /// <param name="messageBus">The message bus to use for the block.</param>
 /// <param name="block">The function to execute.</param>
 /// <returns>The return value of the function.</returns>
 public static TRet With <TRet>(this IMessageBus messageBus, Func <TRet> block)
 {
     using (messageBus.WithMessageBus()) {
         return(block());
     }
 }