public void PartialsInCascadingBaseFoldersAndSharedFoldersAreDiscovered() { var viewFolder = new InMemoryViewFolder { { "area1\\controller2\\view3.spark", "" }, { "area1\\controller2\\Shared\\_alpha.spark", "" }, { "area1\\Shared\\_beta.spark", "" }, { "Shared\\_gamma.spark", "" }, { "area1\\controller2\\_epsilon.spark", "" }, { "area1\\_zeta.spark", "" }, { "_eta.spark", "" }, { "area1\\controller4\\_dontfind1.spark", "" }, { "area1\\controller4\\Shared\\_dontfind2.spark", "" }, { "area2\\Shared\\_dontfind3.spark", "" }, }; var viewLoader = new ViewLoader { ViewFolder = viewFolder }; var partials = viewLoader.FindPartialFiles("area1\\controller2\\view3.spark"); Assert.That(partials, Has.Some.EqualTo("alpha")); Assert.That(partials, Has.Some.EqualTo("beta")); Assert.That(partials, Has.Some.EqualTo("gamma")); Assert.That(partials, Has.Some.EqualTo("epsilon")); Assert.That(partials, Has.Some.EqualTo("zeta")); Assert.That(partials, Has.Some.EqualTo("eta")); Assert.That(partials, Has.None.EqualTo("dontfind1")); Assert.That(partials, Has.None.EqualTo("dontfind2")); Assert.That(partials, Has.None.EqualTo("dontfind3")); }
public void PartialsInCascadingBaseFoldersAndSharedFoldersAreDiscovered() { var viewFolder = new InMemoryViewFolder { { Path.Combine("area1", "controller2", "view3.spark"), "" }, { Path.Combine("area1", "controller2", "Shared", "_alpha.spark"), "" }, { Path.Combine("area1", "Shared", "_beta.spark"), "" }, { Path.Combine("Shared", "_gamma.spark"), "" }, { Path.Combine("area1", "controller2", "_epsilon.spark"), "" }, { Path.Combine("area1", "_zeta.spark"), "" }, { "_eta.spark", "" }, { Path.Combine("area1", "controller4", "_dontfind1.spark"), "" }, { Path.Combine("area1", "controller4", "Shared", "_dontfind2.spark"), "" }, { Path.Combine("area2", "Shared", "_dontfind3.spark"), "" }, }; var viewLoader = new ViewLoader { ViewFolder = viewFolder }; var partials = viewLoader.FindPartialFiles(Path.Combine("area1", "controller2", "view3.spark")); Assert.That(partials, Has.Some.EqualTo("alpha")); Assert.That(partials, Has.Some.EqualTo("beta")); Assert.That(partials, Has.Some.EqualTo("gamma")); Assert.That(partials, Has.Some.EqualTo("epsilon")); Assert.That(partials, Has.Some.EqualTo("zeta")); Assert.That(partials, Has.Some.EqualTo("eta")); Assert.That(partials, Has.None.EqualTo("dontfind1")); Assert.That(partials, Has.None.EqualTo("dontfind2")); Assert.That(partials, Has.None.EqualTo("dontfind3")); }
public void FindPartialFiles() { var partials3 = loader.FindPartialFiles("Home\\other.spark"); var partials2 = loader.FindPartialFiles("Account\\index.spark"); viewFolder.VerifyAllExpectations(); syntaxProvider.VerifyAllExpectations(); Assert.AreEqual(3, partials3.Count); Assert.That(partials3.Contains("comment")); Assert.That(partials3.Contains("header")); Assert.That(partials3.Contains("footer")); Assert.AreEqual(2, partials2.Count); Assert.That(partials2.Contains("header")); Assert.That(partials2.Contains("footer")); }
public void PartialsInSameFolderAreDiscovered() { var viewFolder = new InMemoryViewFolder { { "home\\zero.spark", "" }, { "home\\_one.spark", "" }, { "product\\two.spark", "" }, { "product\\_three.spark", "" }, { "product\\_four.spark", "" }, { "invoice\\five.spark", "" }, }; var viewLoader = new ViewLoader { ViewFolder = viewFolder }; var zero = viewLoader.FindPartialFiles("home\\zero.spark"); var product = viewLoader.FindPartialFiles("product\\two.spark"); var invoice = viewLoader.FindPartialFiles("invoice\\five.spark"); Assert.That(zero.Count(), Is.EqualTo(1)); Assert.That(zero, Has.Some.EqualTo("one")); Assert.That(product.Count(), Is.EqualTo(2)); Assert.That(product, Has.Some.EqualTo("three")); Assert.That(product, Has.Some.EqualTo("four")); Assert.That(invoice.Count(), Is.EqualTo(0)); zero = viewLoader.FindPartialFiles("home/zero.spark"); product = viewLoader.FindPartialFiles("product/two.spark"); invoice = viewLoader.FindPartialFiles("invoice/five.spark"); Assert.That(zero.Count(), Is.EqualTo(1)); Assert.That(zero, Has.Some.EqualTo("one")); Assert.That(product.Count(), Is.EqualTo(2)); Assert.That(product, Has.Some.EqualTo("three")); Assert.That(product, Has.Some.EqualTo("four")); Assert.That(invoice.Count(), Is.EqualTo(0)); }
public IList <string> GetRelatedPartials() { return(_viewLoader.FindPartialFiles(_viewPath)); }