Exemplo n.º 1
0
        public void ShouldLoadFromDiskIfPathNotInCache()
        {
            string contents = String.Empty;
            var cache = new CachingViewFolder(ROOT_VIEW_PATH);
            var content = cache.GetViewSource("Shared\\Application.spark");

            using (TextReader reader = new StreamReader(content.OpenViewStream()))
                contents = reader.ReadToEnd();

            Assert.That(contents.Contains("no header by default"));
        }
        public void ShouldLoadFromDiskIfPathNotInCache()
        {
            string contents = String.Empty;
            var    cache    = new CachingViewFolder(ROOT_VIEW_PATH);
            var    content  = cache.GetViewSource("Shared\\Application.spark");

            using (TextReader reader = new StreamReader(content.OpenViewStream()))
                contents = reader.ReadToEnd();

            Assert.That(contents.Contains("no header by default"));
        }
Exemplo n.º 3
0
        public void ShouldAllowCacheContentToBeReplaced()
        {
            string path = "Shared\\test.spark";
            string contents = String.Empty;
            var cache = new CachingViewFolder(ROOT_VIEW_PATH);
            cache.Add(path);
            string newContent = "This is new content";

            cache.SetViewSource(path, newContent);
            var content = cache.GetViewSource(path);
            using (TextReader reader = new StreamReader(content.OpenViewStream()))
                contents = reader.ReadToEnd();

            Assert.That(contents.Contains(newContent));
        }
        public void ShouldAllowCacheContentToBeReplaced()
        {
            string path     = "Shared\\test.spark";
            string contents = String.Empty;
            var    cache    = new CachingViewFolder(ROOT_VIEW_PATH);

            cache.Add(path);
            string newContent = "This is new content";

            cache.SetViewSource(path, newContent);
            var content = cache.GetViewSource(path);

            using (TextReader reader = new StreamReader(content.OpenViewStream()))
                contents = reader.ReadToEnd();

            Assert.That(contents.Contains(newContent));
        }