public void GivenSizeFallsShortOfMin_WhenValidate_ThenThrowException() { HttpPostedFileBase test = MockRepository.GenerateMock<HttpPostedFileBase>(); test.Expect(t => t.ContentLength).Return(20); var target = new FileSizeAttribute(100, 200); target.ExpectException<ValidationException>(() => target.Validate(test, "blah")); }
public void GivenValidSize_WhenValidate_ThenSucceed() { HttpPostedFileBase test = MockRepository.GenerateMock <HttpPostedFileBase>(); test.Expect(t => t.ContentLength).Return(50); var target = new FileSizeAttribute(0, 100); target.Validate(test, "blah"); }
public void GivenSizeFallsShortOfMin_WhenValidate_ThenThrowException() { HttpPostedFileBase test = MockRepository.GenerateMock <HttpPostedFileBase>(); test.Expect(t => t.ContentLength).Return(20); var target = new FileSizeAttribute(100, 200); target.ExpectException <ValidationException>(() => target.Validate(test, "blah")); }
public void GivenValidSize_WhenValidate_ThenSucceed() { HttpPostedFileBase test = MockRepository.GenerateMock<HttpPostedFileBase>(); test.Expect(t => t.ContentLength).Return(50); var target = new FileSizeAttribute(0, 100); target.Validate(test, "blah"); }