Exemplo n.º 1
0
        public void Request_ShouldNotResponse_AfteRemove()
        {
            var eventBus = new InProcessServiceBus();

            Func <dynamic, IRequestHandlerContext, Task> delateFunc = (eventData, context) =>
            {
                return(Task.Run(() =>
                {
                    context.Response = (string)eventData.Msg;
                }));
            };

            eventBus.AddRequestHandler <TestRequestData>(delateFunc);
            eventBus.RemoveRequestHandler <TestRequestData>(delateFunc);

            var testRequestData = new TestRequestData()
            {
                Msg = "success"
            };
            var result = eventBus.Send <string>(testRequestData);

            Assert.AreEqual(null, result);
        }