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()); }
public void GetSourceNotFound() { _viewFolder.GetViewSource(NonExistingView); }
public void GetSourceNotFound() { Assert.That(() => _viewFolder.GetViewSource(NonExistingView), Throws.TypeOf <FileNotFoundException>()); }