Ejemplo n.º 1
0
        public SimpleConsumer(ISimpleConsumerDependency dependency)
        {
            _dependency = dependency;
            Console.WriteLine("SimpleConsumer()");

            _received = new ManualResetEvent(false);

            _lastConsumer = this;
            _consumerCreated.Set();
        }
Ejemplo n.º 2
0
        public void Should_receive_using_the_first_consumer()
        {
            const string name = "Joe";

            var complete = new ManualResetEvent(false);

            LocalBus.SubscribeHandler <SimpleMessage>(x => complete.Set());
            LocalBus.Publish(new SimpleMessage(name));

            complete.WaitOne(8.Seconds());

            SimpleConsumer lastConsumer = SimpleConsumer.LastConsumer;

            lastConsumer.ShouldNotBeNull();

            lastConsumer.Last.Name
            .ShouldEqual(name);

            lastConsumer.Dependency.WasDisposed
            .ShouldBeTrue("Dependency was not disposed");
            lastConsumer.Dependency.SomethingDone
            .ShouldBeTrue("Dependency was disposed before consumer executed");
        }