Ejemplo n.º 1
0
        public void Context()
        {
            var container = Stub<IContainer>();
            IoC.Initialize(container);

            _testQueryHandler = Mock<IQueryHandler<TestQuery>>();
            _testQuery = new TestQuery();
            _testQueryHandler.Expect(a => a.Execute<bool>(Arg<TestQuery>.Matches(p => p == _testQuery))).Return(new[] { true });

            container.Stub(x => x.Resolve<IQueryHandler<TestQuery>>()).Return(_testQueryHandler);

            var queryExecutor = new QueryExecutor();
            _result = queryExecutor.Execute<TestQuery, bool>(_testQuery);
        }