예제 #1
0
        public void ResultsAreTheSame()
        {
            IViewSourceLoader loader = new FileSystemViewSourceLoader("MvcContrib.Tests.Views");
            IViewFolder wrapper = new ViewSourceLoaderWrapper(loader);

            Assert.AreEqual(loader.HasView("Home\\foreach.spark"), wrapper.HasView("Home\\foreach.spark"));
            Assert.AreEqual(loader.HasView("Home\\nosuchfile.spark"), wrapper.HasView("Home\\nosuchfile.spark"));

            var loaderViews = loader.ListViews("Shared");
            var wrapperViews = wrapper.ListViews("Shared");
            Assert.AreEqual(loaderViews.Count(), wrapperViews.Count);

            foreach (var viewName in loaderViews)
            {
                Assert.That(wrapperViews.Contains(viewName));
            }

            var loaderView = loader.GetViewSource("Home\\foreach.spark");
            var wrapperView = wrapper.GetViewSource("Home\\foreach.spark");

            Assert.AreEqual(loaderView.LastModified, wrapperView.LastModified);

            var loaderReader = new StreamReader(loaderView.OpenViewStream());
            var wrapperReader = new StreamReader(wrapperView.OpenViewStream());
            Assert.AreEqual(loaderReader.ReadToEnd(), wrapperReader.ReadToEnd());
        }
예제 #2
0
        public void Init()
        {
            var container = MockRepository.GenerateStub <IViewSourceLoaderContainer>();

            container.ViewSourceLoader = MockRepository.GenerateStub <IViewSourceLoader>();
            container.ViewSourceLoader.Stub(x => x.GetViewSource(NonExistingView)).Return(null);
            _viewFolder = new ViewSourceLoaderWrapper(container);
        }