???????WebForm??UI???????????
???????????? ???????[ 2013/1/28 10:42:36 ] ????????
????BS???е?UI????????????????????????????Request?????????Response??????WebForm???MVC????????????Response??Request??HTTP???????????н???????????????????WebForm??????????Response??????????????????????
public sealed class HttpResponse
???????????????sealed?????仰??????????????????μ??Code-Behind?????????????????????????
protected void Page_Load(object sender?? EvengArgs e)
{
this.Response.Write("test u");
}
????????FCL????????????HttpResponseWrapper??????????????????????д?????????????????????????μ???????????????????
protected HttpResponseBase _response;
protected override void OnPreLoad(EventArgs e)
{
base.OnPreLoad(e);
_response = new HttpResponseWrapper(this.Response);
}
protected void Page_Load(object sender?? EvengArgs e)
{
_response.Write("test u");
}
???????????????????????й???????????????????????????
????1???????this.Response???????????????HttpResponseBase??
????2????Σ?????Page_Load??????????????????????????????
?????????????_response???????????????????????????????????????????????webform????????????????????У?this.Response????????????????????????????з????OnPreLoad?С?
??????????????????????д????????????Page_Load??protected?????ò????????????????????public???????ò????????????????棬??????????????
[TestClass]
public class _DefaultTest: _Default ////?????????????????Default.aspx.cs?????
{
public Mock
[TestMethod]
StringWriter sw = new StringWriter();
FakeResponse.Setup(x=>x.Write(It.IsAny
this.Page_Load(null??null);
public void LoadOk()
{
FakeResponse = new Mock
FakeResponse.SetupGet(x=>x.OutPut).Returns(sw);
this._response = FakeResponse.Object;
{
sw.Write(x);
sw.Flush();
}
Assert.AreEqual(
“test u”??
(FakeResponse.Object.Output as StringWriter).ToString();
}
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11