public static void AssertContentMatches(this Stream s, string content)
        {
            var s2 = new MemoryStream((int)s.Length);

            AsyncPump.Run(() => s.CopyToAsync(s2));
            s2.Seek(0, SeekOrigin.Begin);
            using (var reader = new StreamReader(s2))
            {
                var actualContent = reader.ReadToEnd();
                var regex         = new Regex($"^{RegexExtensions.GlobToRexex(content)}$", RegexOptions.IgnoreCase);
                Assert.True(regex.IsMatch(actualContent),
                            string.Format("\r\n{0} and \r\n{1} do not match.", actualContent, content));
            }
        }
Beispiel #2
0
 public static Regex MatchGlob(string glob)
 {
     return(new Regex($"^{RegexExtensions.GlobToRexex(glob)}$", RegexOptions.IgnoreCase));
 }