Ejemplo n.º 1
0
        public void Parse_ValidTimestamp_ParsesDateTimeOffset(SampleTimestamp testCase)
        {
            DateTimeOffset actual;

            Assert.True(MatchExtensions.TryParseTimestamp(testCase.RawTimestamp, out actual));
            Assert.Equal(testCase.ExpectedDateTimeOffset, actual);
        }
        internal HttpTransferEncodingField(byte[] fieldValue)
            : base("Transfer-Encoding", (IList <byte>)fieldValue)
        {
            string @string = HttpRegex.GetString(fieldValue);
            Match  match   = HttpTransferEncodingField._regex.Match(@string);

            if (!match.Success)
            {
                return;
            }
            this.SetTransferCodings((IList <string>)Enumerable.ToArray <string>(MatchExtensions.GroupCapturesValues(match, "TransferCoding")));
        }
Ejemplo n.º 3
0
        internal HttpTrailerField(byte[] fieldValue)
            : base("Trailer", (IList <byte>)fieldValue)
        {
            string @string = HttpRegex.GetString(fieldValue);
            Match  match   = HttpTrailerField._regex.Match(@string);

            if (!match.Success)
            {
                return;
            }
            this.SetFieldNames(MatchExtensions.GroupCapturesValues(match, "FieldName"));
        }
        internal HttpContentTypeField(byte[] fieldValue)
            : base("Content-Type", (IList <byte>)fieldValue)
        {
            string @string = HttpRegex.GetString(fieldValue);
            Match  match   = HttpContentTypeField._regex.Match(@string);

            if (!match.Success)
            {
                return;
            }
            this.MediaType    = Enumerable.First <Capture>(Enumerable.Cast <Capture>((IEnumerable)match.Groups["MediaType"].Captures)).Value;
            this.MediaSubtype = Enumerable.First <Capture>(Enumerable.Cast <Capture>((IEnumerable)match.Groups["MediaSubType"].Captures)).Value;
            this.Parameters   = new HttpFieldParameters(MatchExtensions.GroupCapturesValues(match, "ParameterName"), MatchExtensions.GroupCapturesValues(match, "ParameterValue"));
        }