Example #1
0
        public void does_not_throw_stack_overflow()
        {
            var kernel  = new StandardKernel();
            var adapter = new NinjectContainerAdapter(kernel);

            Assert.DoesNotThrow(() => adapter.RegisterGeneric(typeof(IGenericInterface <>), typeof(GenericImpl <>)));
        }
        public void SetUp()
        {
            _container = new StandardKernel();

            var adapter = new NinjectContainerAdapter(_container);

            _plattform = new TestPlattform(adapter);
        }
Example #3
0
        public void registers_generic_types_correctly()
        {
            var kernel  = new StandardKernel();
            var adapter = new NinjectContainerAdapter(kernel);

            adapter.RegisterGeneric(typeof(IGenericInterface <>), typeof(GenericImpl <>));

            var instance = kernel.Get <IGenericInterface <string> >();

            Assert.NotNull(instance);
            Assert.That(instance, Is.TypeOf(typeof(GenericImpl <string>)));
        }
Example #4
0
        public GASender()
        {
            InitializeComponent();

            _logger = LogManager.GetLogger(GetType().Name);
            try
            {
                var busConfiguration = ConfigService.Instance.Bus;

                if (busConfiguration == null)
                {
                    throw new Exception("BusConfiguration must be set in config");
                }

                var kernel = new StandardKernel();

                kernel.Bind <IMessageBodySerializer>().To <DefaultJsonSerializer>().InSingletonScope();
                kernel.Bind <IBusLogger>().To <CustomNLogger>().InSingletonScope();

                NinjectContainerAdapter.CreateInstance(kernel);
                BusFactory.SetContainerFactory(NinjectContainerAdapter.GetInstance);
                _messageBus = BusFactory.CreateBus();

                _repository = new Repository.Repository(ConfigService.Instance.Payments.W1ConnectionString);

                _sendService = new PaymentsService(
                    _repository,
                    ConfigService.Instance.Common.GoogleAnaliticsUrl,
                    ConfigService.Instance.Common.TrackingId,
                    ConfigService.Instance.Payments.Interval,
                    ConfigService.Instance.Common.GoogleAnaliticsTimeout,
                    ConfigService.Instance.Payments.StartTime,
                    ConfigService.Instance);
            }
            catch (Exception exception)
            {
                _logger.Error(exception);
                throw;
            }
        }
Example #5
0
 static void Main(string[] args)
 {
     using (var kernel = new StandardKernel(new Bindings()))
     {
         var log = kernel.Get <ILogger>();
         log.Information("App started");
         var _container = new NinjectContainerAdapter(kernel);
         using (var _bus = _container.DeployMessageBus($"AnyLaborer"))
         {
             _bus.Subscribe(typeof(MessageExtractWallPostsCommand));
             _bus.Subscribe(typeof(MessageWallPostLikesRepostsComments));
             _bus.Subscribe(typeof(MessageUserGet));
             _bus.Publish(new MessageExtractWallPostsCommand {
                 OwnerId = -29534144, PostCount = 100
             });
             Console.ReadLine();
             _bus.Unsubscribe(typeof(MessageExtractWallPostsCommand));
             _bus.Unsubscribe(typeof(MessageWallPostLikesRepostsComments));
             _bus.Unsubscribe(typeof(MessageUserGet));
         }
     }
 }
Example #6
0
        public static void Start(IKernel kernel)
        {
            Guard.AgainstNullOrEmpty(kernel);

            var adapter = new NinjectContainerAdapter(kernel);

            var bus = Configure
                      .With(adapter)
                      .Logging(log => log.Use(new Log4NetLoggerFactory()))
                      .MessageOwnership(d => d.FromRebusConfigurationSection())

                      // todo: while in dev, this uses MSMQ
                      // when deploying, this should be changed to the Azure Stuff
                      .Transport(transport => transport.UseMsmqAndGetInputQueueNameFromAppConfig())

                      .Subscriptions(subscription => subscription.StoreInSqlServer(Config.ConnectionString, Config.RebusSubscriptionTableName).EnsureTableIsCreated())
                      .Sagas(saga => saga.StoreInSqlServer(Config.ConnectionString, Config.RebusSagaTable, Config.RebusSagaIndexTable).EnsureTablesAreCreated())
                      .CreateBus()
                      .Start();

            bus.Subscribe <PropertyCreated>();
        }
Example #7
0
        public void SetUp()
        {
            _container = new StandardKernel();

            _adapter = new NinjectContainerAdapter(_container);
        }