public RPCMiddlewareTest()
        {
            this.authorization   = new Mock <IRPCAuthorization>();
            this.delegateContext = new Mock <RequestDelegate>();

            this.httpContext       = new DefaultHttpContext();
            this.response          = new HttpResponseFeature();
            this.request           = new HttpRequestFeature();
            this.response.Body     = new MemoryStream();
            this.featureCollection = new FeatureCollection();

            this.httpContextFactory = new Mock <IHttpContextFactory>();
            this.httpContextFactory.Setup(f => f.Create(It.IsAny <FeatureCollection>())).Returns((FeatureCollection f) => {
                DefaultHttpContext newHttpContext = new DefaultHttpContext();
                newHttpContext.Initialize(f);

                return(newHttpContext);
            });

            var nodeSettings = new NodeSettings(new StratisRegTest());

            this.rpcSettings = new RpcSettings(nodeSettings);

            this.middleware = new RPCMiddleware(this.delegateContext.Object, this.authorization.Object, this.LoggerFactory.Object, this.httpContextFactory.Object, new DataFolder(string.Empty), this.rpcSettings);
        }
Ejemplo n.º 2
0
        public RPCMiddlewareTest()
        {
            this.httpContext     = new DefaultHttpContext();
            this.authorization   = new Mock <IRPCAuthorization>();
            this.delegateContext = new Mock <RequestDelegate>();

            this.httpContext       = new DefaultHttpContext();
            this.response          = new HttpResponseFeature();
            this.request           = new HttpRequestFeature();
            this.response.Body     = new MemoryStream();
            this.featureCollection = new FeatureCollection();

            this.middleware = new RPCMiddleware(this.delegateContext.Object, this.authorization.Object, this.LoggerFactory.Object);
        }