private MyReadOnlyKernel CreateReadOnlyKernel(Dictionary <Type, ICollection <IBinding> > bindings) { var sequence = new MockSequence(); BindingResolverMock1.InSequence(sequence) .Setup(p => p.Resolve(It.IsAny <Dictionary <Type, ICollection <IBinding> > >(), typeof(IReadOnlyKernel))) .Returns(Array.Empty <IBinding>); BindingResolverMock2.InSequence(sequence) .Setup(p => p.Resolve(It.IsAny <Dictionary <Type, ICollection <IBinding> > >(), typeof(IReadOnlyKernel))) .Returns(Array.Empty <IBinding>); BindingResolverMock1.InSequence(sequence) .Setup(p => p.Resolve(It.IsAny <Dictionary <Type, ICollection <IBinding> > >(), typeof(IResolutionRoot))) .Returns(Array.Empty <IBinding>); BindingResolverMock2.InSequence(sequence) .Setup(p => p.Resolve(It.IsAny <Dictionary <Type, ICollection <IBinding> > >(), typeof(IResolutionRoot))) .Returns(Array.Empty <IBinding>); return(new MyReadOnlyKernel(NinjectSettingsMock.Object, bindings, CacheMock.Object, PlannerMock.Object, ConstructorScorerMock.Object, PipelineMock.Object, ExceptionFormatterMock.Object, BindingPrecedenceComparerMock.Object, BindingResolvers, MissingBindingResolvers)); }
public WhenCanResolveIsCalled() { var bindingsForSword = new List <IBinding> { CreateBinding(typeof(Sword), true) }; var bindings = new Dictionary <Type, ICollection <IBinding> > { { typeof(Sword), bindingsForSword } }; BindingResolverMock1.Setup(p => p.Resolve(bindings, typeof(Sword))).Returns(bindingsForSword); BindingResolverMock2.Setup(p => p.Resolve(bindings, typeof(Sword))).Returns(Array.Empty <IBinding>()); _readOnlyKernel = CreateReadOnlyKernel(bindings); }