Example #1
0
        protected string[] GetStringsExample(StringsExample example)
        {
            switch (example)
            {
            case StringsExample.Null:
                return(null);

            case StringsExample.Empty:
                return(Array.Empty <string>());

            case StringsExample.ValidHosts:
                return(new[] { "valid1", "*.example.com", "example.*", "10.0.0.1", "2001:0db8:85a3:0000:0000:8a2e:0370:7334" });

            case StringsExample.ValidMethods:
                return(new[] { "OPTIONS", "GET", "HEAD", "POST", "PUT", "DELETE", "TRACE", "CONNECT", "extension-method" });

            case StringsExample.ValidPaths:
                return(new[] { "/valid1", "/(?i)orders/(?i)deliverystate/(?i)driverlocation$", "/(?i)restaurants/\\S+/temporary-offline-status$", "/(?i)invoices/\\d+" });

            case StringsExample.InvalidPaths:
                return(new[] { "notvalid" });

            case StringsExample.InvalidNull:
                return(new string[] { null });

            case StringsExample.InvalidEmpty:
                return(new[] { string.Empty });

            case StringsExample.InvalidWhitespace:
                return(new[] { " " });

            case StringsExample.InvalidColon:
                return(new[] { ":" });

            case StringsExample.InvalidWildcard:
                return(new[] { "*" });

            case StringsExample.LeadingAndTrailingWildcards:
                return(new[] { "*.example.*" });

            case StringsExample.InvalidAll:
                return(new[] { null, string.Empty, " ", ":", "*", "*.example.*" });

            default:
                throw new ArgumentOutOfRangeException(nameof(example), example, null);
            }
        }
Example #2
0
        protected string[] GetStringsExample(StringsExample example)
        {
            switch (example)
            {
            case StringsExample.Null:
                return(null);

            case StringsExample.Empty:
                return(Array.Empty <string>());

            case StringsExample.Valid:
                return(new[] { "valid1", "valid2", "valid3" });

            case StringsExample.Invalid:
                return(new[] { null, string.Empty, " ", ":" });

            default:
                throw new ArgumentOutOfRangeException(nameof(example), example, null);
            }
        }