Exemplo n.º 1
0
        public void ResourceWithNoMimeTypeIsInvalid()
        {
            var alert = CreateInfoWithResourceWithDescriptionAndMimeType("Description", null);

            var resourceValidator = new ResourceValidator(alert);

            Assert.False(resourceValidator.IsValid);
        }
Exemplo n.º 2
0
        public void ResourceWithoutMimeTypeAndDescriptionHasTwoErrors()
        {
            var alert = CreateInfoWithResourceWithDescriptionAndMimeType(null, null);

            var resourceValidator = new ResourceValidator(alert);

            Assert.False(resourceValidator.IsValid);
        }
Exemplo n.º 3
0
        public void ResourceWithDescriptionAndMimeTypeIsValid()
        {
            var info = CreateInfoWithResourceWithDescriptionAndMimeType("Description", "image/jpeg");

            var resourceValidator = new ResourceValidator(info);

            Assert.True(resourceValidator.IsValid);
            Assert.Equal(0, resourceValidator.Errors.Count());
        }
Exemplo n.º 4
0
        public void ResourceWithUriAndNoSizeIsInvalid()
        {
            var info     = new Info();
            var resource = new Resource();

            resource.Uri  = new System.Uri("http://www.google.ro");
            resource.Size = null;
            info.Resources.Add(resource);

            var resourceValidator = new ResourceValidator(info);

            Assert.False(resourceValidator.IsValid);

            var sizeErrors = from error in resourceValidator.Errors
                             where error.GetType() == typeof(SizeRequiredError)
                             select error;

            Assert.NotEmpty(sizeErrors);
        }