public void RegisterForDisposal_CalledOutsideTheContextOfAHttpRequest_ThrowsExpectedException()
        {
            // Act
            Action action = () => SimpleInjectorWebExtensions.RegisterForDisposal(new DisposableCommand());

            // Assert
            AssertThat.ThrowsWithExceptionMessageContains <InvalidOperationException>(
                "This method can only be called in the context of a web request", action);
        }
        public void RegisterLifetimeScopeTServiceFunc_WithNullFuncArgument_ThrowsExpectedException()
        {
            // Act
            Action action = () =>
                            SimpleInjectorWebExtensions.RegisterPerWebRequest <ICommand>(new Container(), null);

            // Assert
            AssertThat.Throws <ArgumentNullException>(action);
        }
        public void RegisterLifetimeScopeTServiceTImplementation_WithNullArgument_ThrowsExpectedException()
        {
            // Act
            Action action = () =>
                            SimpleInjectorWebExtensions.RegisterPerWebRequest <ICommand, ConcreteCommand>(null);

            // Assert
            AssertThat.Throws <ArgumentNullException>(action);
        }
        public void RegisterForDisposal_WithNullArgument_ThrowsExpectedException()
        {
            // Arrange
            var container = new Container();

            // Act
            using (new HttpContextScope())
            {
                try
                {
                    SimpleInjectorWebExtensions.RegisterForDisposal(null);

                    Assert.Fail("Exception expected.");
                }
                catch (ArgumentNullException)
                {
                    // This exception is expected.
                }
            }
        }
Beispiel #5
0
 public void RegisterLifetimeScopeTServiceFunc_WithNullFuncArgument_ThrowsExpectedException()
 {
     SimpleInjectorWebExtensions.RegisterPerWebRequest <ICommand>(new Container(), null);
 }
Beispiel #6
0
 public void RegisterLifetimeScopeTServiceTImplementation_WithNullArgument_ThrowsExpectedException()
 {
     SimpleInjectorWebExtensions.RegisterPerWebRequest <ICommand, ConcreteCommand>(null);
 }