コード例 #1
0
        public void UseBusEngine_registers_BusEngine(INybusConfigurator configurator, TestBusEngine engine)
        {
            IServiceCollection serviceCollection = new ServiceCollection();

            Mock.Get(configurator).Setup(p => p.AddServiceConfiguration(It.IsAny <Action <IServiceCollection> >())).Callback((Action <IServiceCollection> dlg) => dlg(serviceCollection));

            NybusConfiguratorExtensions.UseBusEngine <TestBusEngine>(configurator);

            var serviceProvider = serviceCollection.BuildServiceProvider();

            Assert.That(serviceProvider.GetRequiredService <IBusEngine>(), Is.InstanceOf <TestBusEngine>());
        }
コード例 #2
0
        public void ServiceConfigurator_delegate_is_registered(INybusConfigurator configurator, TestBusEngine engine, Action <IServiceCollection> serviceConfigurator)
        {
            NybusConfiguratorExtensions.UseBusEngine <TestBusEngine>(configurator, serviceConfigurator);

            Mock.Get(configurator).Verify(p => p.AddServiceConfiguration(serviceConfigurator));
        }