Ejemplo n.º 1
0
        public void StylesIntersection_FewStyles_ReturnsDelta()
        {
            var oldStyles = new Dictionary <Type, IStyle>();
            var color     = new TextColor(0);

            color.FromString("#f00");
            oldStyles.Add(color.GetType(), color);
            var font = new Font(2);

            font.FromString("80% arial");
            oldStyles.Add(font.GetType(), font);
            var dockAlign = new DockAlign(4);

            dockAlign.FromString("top");
            oldStyles.Add(dockAlign.GetType(), dockAlign);

            var newStyles  = new Dictionary <Type, IStyle>();
            var whiteSpace = new WhiteSpace(1);

            whiteSpace.FromString("nowrap");
            newStyles.Add(whiteSpace.GetType(), whiteSpace);
            var newFont = new Font(3);

            newFont.FromString("5px tahoma");
            newStyles.Add(newFont.GetType(), newFont);
            var newColor = new TextColor(5);

            newColor.FromString("#F00");
            newStyles.Add(newColor.GetType(), newColor);

            IDictionary <Type, IStyle> actual = _styleSheet.StylesIntersection(oldStyles, newStyles);

            Assert.AreEqual(2, actual.Count);
            Assert.AreEqual(whiteSpace, actual[typeof(WhiteSpace)]);
            Assert.AreEqual(newFont, actual[typeof(Font)]);
        }