예제 #1
0
        public void GivenAValidQqFileExtension_ThenTheModelIsValid()
        {
            var model = new NewMediaViewModel {
                QqFile = "name.jpg"
            };

            Assert.That(model.Validate(null).Count(), Is.EqualTo(0));
        }
예제 #2
0
 public void WhenTheModelHasAnInvalidQqFile_ThenNoMessageIsOutput()
 {
     var model = new NewMediaViewModel();
     model.QqFile = "test.bar";
     var context = new ValidationContext(new object());
     var results = model.Validate(context);
     results.Count().Should().Be(1);
 }
예제 #3
0
        public void GivenAValidFileExtension_ThenTheModelIsValid()
        {
            var model = new NewMediaViewModel {
                File = new TestHttpPostedFileBase("foo.jpg")
            };

            Assert.That(model.Validate(null).Count(), Is.EqualTo(0));
        }
예제 #4
0
 public void WhenTheModelIsValid_ThenNoMessageIsOutput()
 {
     var model = new NewMediaViewModel();
     var file = new TestableHttpPostedFileBase();
     model.File = file;
     var context = new ValidationContext(new object());
     var results = model.Validate(context);
     results.Count().Should().Be(0);
 }