Пример #1
0
 public void Verify_that_it_returns_correct_values(CDP4Color cdp4Color)
 {
     Assert.DoesNotThrow(() => cdp4Color.GetHexValue());
     Assert.IsInstanceOf <string>(cdp4Color.GetHexValue());
     Assert.DoesNotThrow(() => cdp4Color.GetBrush());
     Assert.IsInstanceOf <Brush>(cdp4Color.GetBrush());
 }
Пример #2
0
        /// <summary>
        /// Get the hexadecimal string value representation for a <see cref="CDP4Color"/>.
        /// </summary>
        /// <param name="colorType">The <see cref="CDP4Color"/></param>
        /// <returns>Hexadecimal string value representation</returns>
        public static string GetHexValue(this CDP4Color colorType)
        {
            switch (colorType)
            {
            case CDP4Color.Failed:
                return("#FFD9DA");

            case CDP4Color.Succeeded:
                return("#C4FFBD");

            case CDP4Color.Inconclusive:
                return("#FDFDBF");

            default:
                throw new Exception($"Unknown color type: {colorType}");
            }
        }
Пример #3
0
 /// <summary>
 /// Get the <see cref="SolidColorBrush"/> representation for a <see cref="CDP4Color"/>.
 /// </summary>
 /// <param name="colorType">The <see cref="CDP4Color"/></param>
 /// <returns><see cref="SolidColorBrush"/></returns>
 public static Brush GetBrush(this CDP4Color colorType)
 {
     return((SolidColorBrush) new BrushConverter().ConvertFrom(colorType.GetHexValue()));
 }