Beispiel #1
0
        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"));
        }
Beispiel #2
0
        public void PartialsInSameFolderAreDiscovered()
        {
            var viewFolder = new InMemoryViewFolder
                             {
                                 {Path.Combine("home", "zero.spark"), ""},
                                 {Path.Combine("home", "_one.spark"), ""},
                                 {Path.Combine("product", "two.spark"), ""},
                                 {Path.Combine("product", "_three.spark"), ""},
                                 {Path.Combine("product", "_four.spark"), ""},
                                 {Path.Combine("invoice", "five.spark"), ""},
                             };

            var viewLoader = new ViewLoader { ViewFolder = viewFolder };
            var zero = viewLoader.FindPartialFiles(Path.Combine("home", "zero.spark"));
            var product = viewLoader.FindPartialFiles(Path.Combine("product", "two.spark"));
            var invoice = viewLoader.FindPartialFiles(Path.Combine("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));
        }
Beispiel #3
0
        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"));
        }