コード例 #1
0
        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"));
        }
コード例 #2
0
        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");
        }
コード例 #3
0
        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"));
        }
コード例 #4
0
        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");
        }