public void GivenValidType_WhenIValidate_ThenTrueIsReturned() { var file = MockRepository.GenerateStub<HttpPostedFileBase>(); file.Expect(f => f.FileName).Return("myfile.test"); var target = new FileTypesAttribute("test,testing"); Assert.IsTrue(target.IsValid(file)); }
public void GivenInvalidType_WhenIValidate_ThenFalseIsReturned() { var file = MockRepository.GenerateStub <HttpPostedFileBase>(); file.Expect(f => f.FileName).Return("myfile.blah"); var target = new FileTypesAttribute("test,testing"); Assert.IsFalse(target.IsValid(file)); }
public void GivenNull_WhenIValidate_ThenTrueIsReturned() { var target = new FileTypesAttribute("test,testing"); Assert.IsTrue(target.IsValid(null)); }