Exemple #1
0
 public static void CustomizeContentMediaSubtype(this IFixture fixture)
 {
     fixture.Customize <ContentMediaSubtype>(customization =>
                                             customization.FromFactory <int>(value =>
                                                                             ContentMediaSubtype.Parse(CreateContentMediaSubtypeString(value))
                                                                             ));
 }
Exemple #2
0
        public static ContentType Parse(string value)
        {
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            var parts = value.Split('/');

            if (parts.Length != 2)
            {
                throw new FormatException("The content type value is not a well formed 'type/subtype'.");
            }

            var type    = ContentMediaType.Parse(parts[0]);
            var subtype = ContentMediaSubtype.Parse(parts[1]);

            return(new ContentType(type, subtype));
        }
Exemple #3
0
 public void ParseValueCanNotBeNull()
 {
     Assert.Throws <ArgumentNullException>(() => ContentMediaSubtype.Parse(null));
 }