예제 #1
0
        public void SetUp()
        {
            FubuTransport.Reset();

            // Need to do something about this.  Little ridiculous
            var settings = new BusSettings
            {
                Downstream = "lq.tcp://localhost:2050/downstream".ToUri()
            };


            var container = new Container();

            container.Inject(settings);
            theClock = new SettableClock();
            container.Inject <ISystemTime>(theClock);

            _runtime = FubuTransport.For <DelayedRegistry>().StructureMap(container)
                       .Bootstrap();

            theServiceBus = _runtime.Factory.Get <IServiceBus>();
            //_runtime.Factory.Get<IPersistentQueues>().ClearAll();

            message1 = new OneMessage();
            message2 = new OneMessage();
            message3 = new OneMessage();
            message4 = new OneMessage();

            Debug.WriteLine("The current Utc time is " + theClock.UtcNow());

            theServiceBus.DelaySend(message1, theClock.UtcNow().AddHours(1));
            theServiceBus.DelaySend(message2, theClock.UtcNow().AddHours(1));
            theServiceBus.DelaySend(message3, theClock.UtcNow().AddHours(2));
            theServiceBus.DelaySend(message4, theClock.UtcNow().AddHours(2));
        }
예제 #2
0
        public void SetUp()
        {
            // Need to do something about this.  Little ridiculous
            FubuTransport.SetupForInMemoryTesting();
            TestMessageRecorder.Clear();
            MessageHistory.ClearAll();
            InMemoryQueueManager.ClearAll();

            runtime = FubuTransport.For <DelayedRegistry>().StructureMap(new Container())
                      .Bootstrap();

            theServiceBus = runtime.Factory.Get <IServiceBus>();

            theClock = runtime.Factory.Get <ISystemTime>().As <SettableClock>();

            message1 = new OneMessage();
            message2 = new OneMessage();
            message3 = new OneMessage();
            message4 = new OneMessage();

            theServiceBus.DelaySend(message1, theClock.UtcNow().AddHours(1));
            theServiceBus.DelaySend(message2, theClock.UtcNow().AddHours(1));
            theServiceBus.DelaySend(message3, theClock.UtcNow().AddHours(2));
            theServiceBus.DelaySend(message4, theClock.UtcNow().AddHours(2));
        }
        public void SetUp()
        {
            // Need to do something about this.  Little ridiculous
            var settings = new BusSettings
            {
                Downstream = "lq.tcp://localhost:2050/downstream".ToUri()
            };


            theClock = new SettableClock();


            _runtime = FubuRuntime.For <DelayedRegistry>(_ =>
            {
                _.Services.ReplaceService(settings);
                _.Services.ReplaceService <ISystemTime>(theClock);
            });

            theServiceBus = _runtime.Get <IServiceBus>();
            //_runtime.Get<IPersistentQueues>().ClearAll();

            message1 = new OneMessage();
            message2 = new OneMessage();
            message3 = new OneMessage();
            message4 = new OneMessage();

            Debug.WriteLine("The current Utc time is " + theClock.UtcNow());

            theServiceBus.DelaySend(message1, theClock.UtcNow().AddHours(1));
            theServiceBus.DelaySend(message2, theClock.UtcNow().AddHours(1));
            theServiceBus.DelaySend(message3, theClock.UtcNow().AddHours(2));
            theServiceBus.DelaySend(message4, theClock.UtcNow().AddHours(2));
        }
        public void write_audit_message()
        {
            var auditor = theContainer.GetInstance <PersistedLoginAuditor>();

            auditor.Audit(new Something {
                UserName = "******"
            });

            var theAudit = theContainer.GetInstance <IEntityRepository>().All <Audit>().Where(x => x.Type == "Something").Single();

            theAudit.Message.ShouldBeOfType <Something>().UserName.ShouldEqual("the something");
            theAudit.Timestamp.ShouldEqual(theTime.UtcNow());
            theAudit.Username.ShouldEqual("the something");
        }
예제 #5
0
        public void set_the_clock()
        {
            var clock    = new SettableClock();
            var localNow = DateTime.Today.AddHours(8);

            clock.LocalNow(localNow, TimeZoneInfo.Local);

            clock.LocalTime().Time.ShouldEqual(localNow);

            clock.UtcNow().ShouldEqual(localNow.ToUniversalTime(TimeZoneInfo.Local));
        }
예제 #6
0
        public void set_the_clock_with_a_local_time()
        {
            var local = LocalTime.AtMachineTime("0800");

            var clock = new SettableClock();

            clock.LocalNow(local);

            clock.LocalTime().ShouldNotBeTheSameAs(local).ShouldEqual(local);

            clock.UtcNow().ShouldEqual(local.UtcTime);
        }