public void GivenAValidQqFileExtension_ThenTheModelIsValid() { var model = new NewMediaViewModel { QqFile = "name.jpg" }; Assert.That(model.Validate(null).Count(), Is.EqualTo(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); }
public void GivenAValidFileExtension_ThenTheModelIsValid() { var model = new NewMediaViewModel { File = new TestHttpPostedFileBase("foo.jpg") }; Assert.That(model.Validate(null).Count(), Is.EqualTo(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); }