public void ShouldThrowNotSupportedExceptionForOtherThanRequestInitializationContextTypeOfContexts()
    {
      RequestInitializationActionDiscoverer discoverer = new RequestInitializationActionDiscoverer();

      Assert.ThrowsDelegate action = () => discoverer.GetInitializationActions(new object());

      Assert.Throws<NotSupportedException>(action);
    }
    public void ShouldGetInitializationActionsFromRequest()
    {
      object[] arguments = { "argument" };
      RequestInitializationContext context = new RequestInitializationContext(new Request { InitializationHandlers = { new InitializationHandler(typeof(SampleInitializationHandler), arguments) } }, new Response());
      RequestInitializationActionDiscoverer discoverer = new RequestInitializationActionDiscoverer();

      IEnumerable<InitializationAction> result = discoverer.GetInitializationActions(context).ToArray();

      Assert.Equal(1, result.Count());
      Assert.Equal(typeof(SampleInitializationHandler).FullName, result.Single().Id);
      Assert.IsType<InitializationHandler>(result.Single().State);
      Assert.Equal(typeof(SampleInitializationHandler), ((InitializationHandler)result.Single().State).Type);
      Assert.Equal(arguments, ((InitializationHandler)result.Single().State).Arguments);
      Assert.Equal(context, result.Single().Context);
    }