Exemplo n.º 1
0
        public void should_leverage_the_underlying_container_it_was_initialized_with()
        {
            var presenter = mockery.DynamicMock <IPresenter>();

            using (mockery.Record()) {
                Expect
                .Call(registry.FindAnImplementationOf <IPresenter>())
                .Return(presenter)
                .Repeat
                .AtLeastOnce();
            }

            using (mockery.Playback()) {
                Resolve.DependencyFor <IPresenter>();
            }
        }
Exemplo n.º 2
0
 public static DependencyToResolve DependencyFor <DependencyToResolve>()
 {
     try {
         return(underlyingRegistry.FindAnImplementationOf <DependencyToResolve>());
     }
     catch (Exception e) {
         throw new DependencyResolutionException <DependencyToResolve>(e);
     }
 }
Exemplo n.º 3
0
        public void should_throw_a_dependency_resolution_exception()
        {
            using (mockery.Record()) {
                SetupResult
                .For(registry.FindAnImplementationOf <IPresenter>())
                .Throw(new Exception());
            }

            using (mockery.Playback()) {
                Resolve.DependencyFor <IPresenter>();
            }
        }