Example #1
0
        public void SolidColorBrushDefinitionsAreCorrect()
        {
            Assert.AreEqual(
                "<SolidColorBrush\n  x:Key=\"MyKey\"\n  Color=\"{MyColor}\" />",
                SystemBrushDefinitionFactory.SolidColorBrushDefinition("MyKey", "{MyColor}"));

            Assert.AreEqual(
                "<SolidColorBrush\n  x:Key=\"MyKey\"\n  Color=\"{MyColor}\" Opacity=\"0.4\" />",
                SystemBrushDefinitionFactory.SolidColorBrushDefinition("MyKey", "{MyColor}", 0.4));
        }
        public void FiltersCorrectly()
        {
            SystemBrushItemSource systemBrushSource = new SystemBrushItemSource();

            string brushName   = "SystemControlBackgroundAccentBrush";
            string correctXAML = SystemBrushDefinitionFactory.SolidColorBrushDefinition("SystemControlBackgroundAccentBrush", "{ThemeResource SystemAccentColor}");

            systemBrushSource.Filter(brushName);

            Assert.IsTrue(0 < systemBrushSource.FilteredItems.Count);
            foreach (SystemBrush brush in systemBrushSource.FilteredItems)
            {
                Assert.AreEqual(brushName, brush.Key);
                Assert.AreEqual(correctXAML, brush.XAMLDefinition);
            }
        }