Ejemplo n.º 1
0
        public void TestInitialise()
        {
            _Snapshot            = Factory.TakeSnapshot();
            _SharedConfiguration = TestUtilities.CreateMockSingleton <ISharedConfiguration>();
            _Configuration       = new Configuration();
            _SharedConfiguration.Setup(r => r.Get()).Returns(_Configuration);
            _UserManager = TestUtilities.CreateMockSingleton <IUserManager>();

            _RemoteIpAddress           = "127.0.0.1";
            _AccessFilter              = MockAccessFilter.CreateAndRegister();
            _BasicAuthenticationFilter = MockBasicAuthenticationFilter.CreateAndRegister();
            _RedirectionFilter         = MockRedirectionFilter.CreateAndRegister();

            _RamHost                    = Factory.Resolve <IHostRam>();
            _PipelineBuilder            = Factory.Resolve <IPipelineBuilder>();
            _PipelineBuilderEnvironment = Factory.Resolve <IPipelineBuilderEnvironment>();
            _WebApiMiddleware           = Factory.Resolve <IWebApiMiddleware>();

            _PipelineBuilder.RegisterCallback(UseSetupTestEnvironment, StandardPipelinePriority.Access - 1);
            _PipelineBuilder.RegisterCallback(UseWebApi, StandardPipelinePriority.WebApi);

            _Context = new OwinContext();
            _Context.RequestHeaders  = new HeadersDictionary();
            _Context.ResponseHeaders = new HeadersDictionary();

            _RequestStream        = new MemoryStream();
            _ResponseStream       = new MemoryStream();
            _Context.RequestBody  = _RequestStream;
            _Context.ResponseBody = _ResponseStream;

            _Context.CallCancelled         = new CancellationToken();
            _Context.Version               = "1.0.0";
            _Context.RequestHost           = "127.0.0.1:80";
            _Context.RequestProtocol       = Formatter.FormatHttpProtocol(HttpProtocol.Http1_1);
            _Context.RequestScheme         = Formatter.FormatHttpScheme(HttpScheme.Http);
            _Context.RequestPathBase       = "/VirtualRadar";
            _Context.ServerLocalIpAddress  = "1.2.3.4";
            _Context.ServerLocalPortNumber = 80;

            ExtraInitialise();

            _RamHost.Initialise(_PipelineBuilder, _PipelineBuilderEnvironment);
            _RamHost.Start();
        }
Ejemplo n.º 2
0
 public void RegisterMiddlewareBuilder_Throws_If_Passed_Null()
 {
     _PipelineBuilder.RegisterCallback(null, 0);
 }