예제 #1
0
        public void Dispatch_Should_Call_TryHandle()
        {
            TestResponse expectedResult = new TestResponse {
                Name = "Tata"
            };
            TestQuery testQuery = new TestQuery();
            FakeHandler <TestResponse> fakeHandler      = new FakeHandler <TestResponse>(expectedResult);
            IDispatcher <IQuery>       DispatcherTested = new Dispatcher <IQuery>(fakeHandler);

            TestResponse result = DispatcherTested.Dispatch <TestResponse>(testQuery);

            result.Should().BeSameAs(expectedResult);
        }
예제 #2
0
        public void Dispatch_Should_Call_TryHandle_On_Corresponding_Handler()
        {
            TestResponse expectedResult = new TestResponse {
                Name = "hjruihreigh"
            };
            FakeHandler <string>       fakeStringHandler = new FakeHandler <string>("Fake");
            FakeHandler <TestResponse> fakeHandler       = new FakeHandler <TestResponse>(expectedResult);
            IDispatcher <IQuery>       DispatcherTested  = new Dispatcher <IQuery>(fakeStringHandler, fakeHandler);
            TestQuery testQuery = new TestQuery();

            TestResponse response = DispatcherTested.Dispatch <TestResponse>(testQuery);

            response.Should().BeSameAs(expectedResult);
        }