コード例 #1
0
            public void CallShouldBeDelegatedToKernelConfiguration()
            {
                KernelConfigurationMock.Setup(p => p.AddBinding(BindingMock.Object));

                NinjectModule.AddBinding(BindingMock.Object);

                KernelConfigurationMock.Verify(p => p.AddBinding(BindingMock.Object), Times.Once());
            }
コード例 #2
0
            public void LoadShouldBeCalled()
            {
                KernelConfigurationMock.Setup(p => p.Components).Returns(ComponentsMock.Object);

                NinjectModule.OnLoad(KernelConfigurationMock.Object, SettingsMock.Object);

                Assert.Equal(1, NinjectModule.LoadCount);
            }
コード例 #3
0
            public void BindingShouldBeAddedToBindings()
            {
                KernelConfigurationMock.Setup(p => p.AddBinding(BindingMock.Object));

                NinjectModule.AddBinding(BindingMock.Object);

                Assert.Equal(1, NinjectModule.Bindings.Count);
                Assert.True(NinjectModule.Bindings.Contains(BindingMock.Object));
            }
コード例 #4
0
            public void SettingsShouldBeAssigned()
            {
                KernelConfigurationMock.Setup(p => p.Components).Returns(ComponentsMock.Object);

                NinjectModule.OnLoad(KernelConfigurationMock.Object, SettingsMock.Object);

                Assert.NotNull(NinjectModule.Settings);
                Assert.Same(SettingsMock.Object, NinjectModule.Settings);
            }
コード例 #5
0
            public void NoArgumentNullCheckShouldBePerformed()
            {
                const IBinding binding = null;

                KernelConfigurationMock.Setup(p => p.AddBinding(binding));

                NinjectModule.AddBinding(binding);

                KernelConfigurationMock.Verify(p => p.AddBinding(binding), Times.Once());
            }
コード例 #6
0
            public void CallShouldBeDelegatedToKernelConfiguration()
            {
                var service = typeof(string);

                KernelConfigurationMock.Setup(p => p.Unbind(service));

                NinjectModule.Unbind(service);

                KernelConfigurationMock.Verify(p => p.Unbind(service), Times.Once());
            }
コード例 #7
0
            public void NoArgumentNullCheckShouldBePerformed()
            {
                const Type service = null;

                KernelConfigurationMock.Setup(p => p.Unbind(service));

                NinjectModule.Unbind(service);

                KernelConfigurationMock.Verify(p => p.Unbind(service), Times.Once());
            }
コード例 #8
0
            public void BindingShouldBeRemovedFromBindings()
            {
                NinjectModule.Bindings.Add(BindingMock.Object);

                KernelConfigurationMock.Setup(p => p.RemoveBinding(BindingMock.Object));

                NinjectModule.RemoveBinding(BindingMock.Object);

                Assert.Empty(NinjectModule.Bindings);
            }
コード例 #9
0
            public void BindingsShouldCleared()
            {
                NinjectModule.Bindings.Add(BindingMock.Object);

                KernelConfigurationMock.Setup(p => p.RemoveBinding(BindingMock.Object));

                NinjectModule.OnUnload();

                Assert.Empty(NinjectModule.Bindings);
            }
コード例 #10
0
            public void BindingsShouldBeRemovedFromKernelConfiguration()
            {
                NinjectModule.Bindings.Add(BindingMock.Object);

                KernelConfigurationMock.Setup(p => p.RemoveBinding(BindingMock.Object));

                NinjectModule.OnUnload();

                KernelConfigurationMock.Verify(p => p.RemoveBinding(BindingMock.Object), Times.Once());
            }
コード例 #11
0
 public WhenAddBindingIsCalledAfterOnLoad()
 {
     KernelConfigurationMock.Setup(p => p.Components).Returns(ComponentsMock.Object);
     NinjectModule.OnLoad(KernelConfigurationMock.Object, SettingsMock.Object);
 }