Ejemplo n.º 1
0
        internal static TestFixture FromStreamContext(StreamContext input)
        {
            if (input == null)
            {
                throw new ArgumentNullException("input");
            }
            var result = Parse(input.ReadAllText());

            result.CopyBaseUri(input.Uri);
            return(result);
        }
Ejemplo n.º 2
0
        public override StreamContext ChangePath(string relativePath)
        {
            if (relativePath == null)
            {
                throw new ArgumentNullException("relativePath");
            }

            UriBuilder baseUri = new UriBuilder(new Uri(_uri, relativePath));

            return(StreamContext.FromSource(baseUri.Uri));
        }
Ejemplo n.º 3
0
        private TestFile DownloadCache(Uri url)
        {
            if (url.IsAbsoluteUri && url.IsFile)
            {
                return(new TestFile(url.LocalPath));
            }

            var tempFile = _createTemp(url.ToString());

            tempFile.WriteAllBytes(StreamContext.FromSource(url).ReadAllBytes());
            return(new TestFile(tempFile.FileName));
        }
Ejemplo n.º 4
0
 public TextReader DownloadText(Uri url)
 {
     return(ReadUrlOrLocalFile(url,
                               u => StreamContext.FromSource(u).OpenText(),
                               u => OpenText(u)));
 }
Ejemplo n.º 5
0
        public StreamReader OpenText(string fileName)
        {
            string actualPath = FindActualPath(fileName);

            return(StreamContext.FromFile(actualPath).OpenText());
        }
Ejemplo n.º 6
0
        public StreamContext Open(string fileName)
        {
            string actualPath = FindActualPath(fileName);

            return(StreamContext.FromFile(actualPath));
        }
Ejemplo n.º 7
0
 public Stream Download(Uri url)
 {
     return(ReadUrlOrLocalFile(url,
                               u => StreamContext.FromSource(u).OpenRead(),
                               u => OpenRead(u)));
 }
Ejemplo n.º 8
0
 public StreamWriter AppendText(string fileName, Encoding encoding)
 {
     return(StreamContext.FromFile(CheckFileName(fileName)).AppendText(encoding));
 }
Ejemplo n.º 9
0
 public static TestFixtureData FromSource(Uri url)
 {
     return(FromStreamContext(StreamContext.FromSource(url)));
 }
Ejemplo n.º 10
0
 public IStreamContext GetStreamContext(string name)
 {
     return(new FixtureWrapper(BaseUri, name, StreamContext.FromText(Values[name])));
 }
Ejemplo n.º 11
0
 public FixtureWrapper(Uri baseUri, string fileName, StreamContext inner)
 {
     _inner = inner;
     _uri   = new Uri(baseUri + "#" + fileName, UriKind.RelativeOrAbsolute);
 }
Ejemplo n.º 12
0
 public static TestFixtureData FromFile(string fileName)
 {
     return(FromStreamContext(StreamContext.FromFile(fileName)));
 }
Ejemplo n.º 13
0
 public StreamWriter AppendText(Encoding encoding)
 {
     ThrowIfDisposed();
     return(StreamContext.FromFile(_fileName).AppendText(encoding));
 }
Ejemplo n.º 14
0
 public StreamReader OpenText(Encoding encoding)
 {
     ThrowIfDisposed();
     return(StreamContext.FromFile(_fileName).OpenText(encoding));
 }