Tests.CompressionHandlerTest.CreateResponseBase C# (CSharp) Метод

CreateResponseBase() публичный статический Метод

public static CreateResponseBase ( ) : System.Web.HttpResponseBase
Результат System.Web.HttpResponseBase
        public static HttpResponseBase CreateResponseBase()
        {
            var responseBase = Substitute.For<HttpResponseBase>();
            var collection = new NameValueCollection();
            responseBase.Headers.Returns(collection);
            responseBase.When(x => x.AppendHeader(Arg.Any<string>(), Arg.Any<string>()))
                .Do(args => collection.Add((string) args[0], (string) args[1]));

            responseBase.Filter = new MemoryStream();

            return responseBase;
        }
    }

Usage Example

 private static HttpResponseBase CreateResponseBase()
 {
     return(CompressionHandlerTest.CreateResponseBase());
 }