コード例 #1
0
        public void attribute_wins_over_configuration()
        {
            theExpression.Worker("foo").HandleMessages(x => x.Name.StartsWith("M"));

            afterCompilingAgainstTheMessageTypes();

            theWorkers.WorkerFor(typeof(M2)).ShouldBe("important");
            theWorkers.WorkerFor(typeof(M3)).ShouldBe("fast");

            theWorkers.WorkerFor(typeof(M2).ToMessageTypeName()).ShouldBe("important");
            theWorkers.WorkerFor(typeof(M3).ToMessageTypeName()).ShouldBe("fast");
        }
コード例 #2
0
        public void set_the_routing_rules()
        {
            theExpression.Worker("foo").HandlesMessage <M4>();
            theExpression.Worker("bar").HandleMessages(t => t.Name.StartsWith("Boo"));

            afterCompilingAgainstTheMessageTypes();

            theWorkers.WorkerFor(typeof(BooM6)).ShouldBe("bar");
            theWorkers.WorkerFor(typeof(BooM7)).ShouldBe("bar");
            theWorkers.WorkerFor(typeof(M4)).ShouldBe("foo");

            theWorkers.WorkerFor(typeof(BooM6).ToMessageAlias()).ShouldBe("bar");
            theWorkers.WorkerFor(typeof(BooM7).ToMessageAlias()).ShouldBe("bar");
            theWorkers.WorkerFor(typeof(M4).ToMessageAlias()).ShouldBe("foo");
        }