???????WebForm??UI???????????
???????????? ???????[ 2013/1/28 10:42:36 ] ????????
???????????????????????????Page_Load??????????????????????????????????“test u”??????????????Response.Write???????????????????????????????????????????????????????????????紫????????????????Response.Write?????????????????????????к???????????????????????????????
????1??????????????Page_Load???????????????????Response.Write???????
????2??Response.Write??Page_Load????е???????????????????????????????????
?????????Response.Write??????TextWriter??????????????????TextWriter?????????StringWriter??
???????????????????????????????????д???????????????????????????????????????
Public void UploadFile()
{
Var file = _request.Files[0];
If(file.contentLength==0 || file.ContentLength > 5 * 1024 * 1024)
{
throw new ArgumentException();
}
File.SaveAs(file.FileName);
}
?????????????????????????????????????????
[TestMethod]
public void ThrowExceptionIfFilelengthInvalid()
{
FakeRequest = new Mock
FakeFiles = new Mock
FakeFile = new Mock
FakeFile.SetupGet(x=> x.ContentLength).Returns(6 * 1024 * 1024);
FakeFiles.SetupGet( x=> x[0]).Returns(FakeFile.Object);
FakeRequest.SetupGet( x=>x.Files).Returns(FakeFiles.Object);
this._request = FakeRequest.Object;
try
{
this.UploadFile();
Assert.Fail();
}
catch(ArugmentOutOfRangeException)
{
}
}
?????????????http://www.cnblogs.com/luminji/archive/2012/11/30/2796032.html
??????
???·???
??????????????????
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