示例#1
0
        public RealTimeNotifier_Tests()
        {
            var defaultNotificationDistributor = LocalIocManager.Resolve <DefaultNotificationDistributer>();

            LocalIocManager.IocContainer.Register(
                Component.For <INotificationDistributer>().Instance(defaultNotificationDistributor)
                .LifestyleSingleton()
                .IsDefault()
                );

            _publisher         = LocalIocManager.Resolve <INotificationPublisher>();
            _realTimeNotifier1 = Substitute.For <IRealTimeNotifier>();
            _realTimeNotifier2 = Substitute.For <IRealTimeNotifier2>();

            var realTimeNotifierType1 = _realTimeNotifier1.GetType();
            var realTimeNotifierType2 = _realTimeNotifier2.GetType();

            LocalIocManager.IocContainer.Register(
                Component.For(realTimeNotifierType1)
                .Instance(_realTimeNotifier1)
                .LifestyleSingleton()
                );
            LocalIocManager.IocContainer.Register(
                Component.For(realTimeNotifierType2)
                .Instance(_realTimeNotifier2)
                .LifestyleSingleton()
                );

            var notificationConfiguration = LocalIocManager.Resolve <INotificationConfiguration>();

            notificationConfiguration.Notifiers.Add(realTimeNotifierType1);
            notificationConfiguration.Notifiers.Add(realTimeNotifierType2);
        }