コード例 #1
0
        public void Passing_a_parsed_date_to_FromUtcTime_results_in_UtcNow_being_that_date()
        {
            var dateTime = DateTime.Parse("2001-01-01 00:00");
            var source   = DummyTimeSource.FromÚtcTime(dateTime);

            source.UtcNow.Should().Be(dateTime);
        }
コード例 #2
0
        public void FromUtcTime_returns_an_instance_with_UtcTime_equal_to_supplied_value()
        {
            DateTime utcNow = DateTime.UtcNow;
            var      uut    = DummyTimeSource.FromÚtcTime(utcNow);

            uut.UtcNow.Should().Be(utcNow);
        }
コード例 #3
0
        public void SetupTask()
        {
            _container = new WindsorContainer();

            _container.ConfigureWiringForTestsCallBeforeAllOtherWiring();

            _messageReceiver = new MessageReceiver();
            _timeSource      = DummyTimeSource.FromLocalTime(DateTime.Parse("2015-01-01 10:00"));

            _container.Register(
                Component.For <DummyTimeSource>().Instance(_timeSource),
                Component.For <IServiceBus>().ImplementedBy <TestingOnlyServiceBus>().LifestyleScoped(),
                Component.For <IWindsorContainer>().Instance(_container),
                Component.For <IHandleMessages <ScheduledMessage> >().Instance(_messageReceiver)
                );

            _container.ConfigureWiringForTestsCallAfterAllOtherWiring();

            _scope = _container.BeginScope();

            _bus = _container.Resolve <IServiceBus>();
        }
コード例 #4
0
 public TestingOnlyServiceBus(IWindsorContainer container, DummyTimeSource timeSource) : base(container)
 {
     _timeSource = timeSource;
     timeSource.UtcNowChanged.Subscribe(SendDueMessages);
 }