Ejemplo n.º 1
0
        public void LocalStyleGroupRegisterTest()
        {
            var styleGroup = new LocalStyleGroup();
            var source     = "path/to/style";
            var style1     = new LinkedStyle(source);
            var style2     = new LinkedStyle(source);

            styleGroup.Register(style1);
            styleGroup.Register(style2);
            Assert.AreEqual(1, styleGroup.Count);
        }
Ejemplo n.º 2
0
        public void LocalStyleGroupRegisterTest3()
        {
            var styleGroup = new LocalStyleGroup {
                Helper = new MockLocalHelper()
            };
            var style1 = "~/Styles/Style1.css";
            var style2 = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "/Styles/Style1.css";

            styleGroup.Register(style1, style2);
            Assert.AreEqual(1, styleGroup.Count);
        }
Ejemplo n.º 3
0
        public void LocalStyleGroupRegisterTest2()
        {
            var styleGroup = new LocalStyleGroup();
            var source     = "path/to/style";
            var style1     = new LinkedStyle(source);
            var style2     = new LinkedStyle(source);

            Assert.IsFalse(styleGroup.HasRegistered(style1));
            Assert.IsFalse(styleGroup.HasRegistered(style2));
            styleGroup.Register(style1);
            Assert.IsTrue(styleGroup.HasRegistered(style1));
            Assert.IsTrue(styleGroup.HasRegistered(style2));
        }
Ejemplo n.º 4
0
        public void LocalStyleGroupRenderTest()
        {
            var style1     = new LinkedStyle("path/to/style1.css");
            var style2     = new LinkedStyle("path/to/style2.css");
            var styleGroup = new LocalStyleGroup();

            styleGroup.Add(style1);
            styleGroup.Add(style2);

            var rendered = styleGroup.Render();
            var expected = style1.Render() + Environment.NewLine + style2.Render();

            Assert.AreEqual(expected, rendered);
        }
Ejemplo n.º 5
0
        public void LocalStyleGroupRegisterTest4()
        {
            var styleGroup = new LocalStyleGroup {
                Helper = new MockLocalHelper()
            };
            var style = "~/Styles/DoesNotExist.css";

            try
            {
                styleGroup.Register(style);
            }
            catch (ResourceNotFoundException)
            {
                return;
            }
            catch (Exception)
            {
                Assert.Fail("Incorrect exception thrown.");
            }
            Assert.Fail("No exception thrown.");
        }
Ejemplo n.º 6
0
        public void LocalStyleGroupAddTest()
        {
            var styleGroup = new LocalStyleGroup();
            var path       = "path/to/style";
            var style1     = new LinkedStyle(path);
            var style2     = new LinkedStyle(path);

            styleGroup.Add(style1);
            try
            {
                styleGroup.Add(style2);
            }
            catch (ResourceAlreadyAddedException)
            {
                return;
            }
            catch (Exception)
            {
                Assert.Fail("Incorrect exception thrown.");
            }
            Assert.Fail("No exception thrown.");
        }