Exemple #1
0
        public static void BgRgb_GivenValidColor_ReturnsNewObject()
        {
            FabulousText text   = string.Empty;
            var          result = Fabulous.BgRgb(12, 34, 56);

            Assert.AreNotSame(text, result);
        }
Exemple #2
0
        public static void BgKeyword_GivenValidColorNameEnum_ReturnsNewObject()
        {
            FabulousText text   = string.Empty;
            var          result = Fabulous.BgKeyword(ColorKeyword.DarkSeaGreen);

            Assert.AreNotSame(text, result);
        }
Exemple #3
0
        public static void BgHex_GivenValidHex_ReturnsObjectWithBackgroundSet()
        {
            var expectedColor = new Rgb(143, 188, 143);
            var result        = Fabulous.BgHex("#8FBC8F");

            Assert.AreEqual(expectedColor, result.BackgroundColor);
        }
Exemple #4
0
        public static void Keyword_GivenValidColorName_ReturnsObjectWithForegroundSet()
        {
            var expectedColor = new Rgb(143, 188, 143);
            var result        = Fabulous.Keyword(nameof(ColorKeyword.DarkSeaGreen));

            Assert.AreEqual(expectedColor, result.ForegroundColor);
        }
Exemple #5
0
        public static void BgHex_GivenValidHex_ReturnsNewObject()
        {
            FabulousText text   = string.Empty;
            var          result = Fabulous.BgHex("#8FBC8F");

            Assert.AreNotSame(text, result);
        }
Exemple #6
0
        public static void BgRgb_GivenValidColor_ReturnsObjectWithBackgroundSet()
        {
            var expectedColor = new Rgb(12, 34, 56);
            var result        = Fabulous.BgRgb(12, 34, 56);

            Assert.AreEqual(expectedColor, result.BackgroundColor);
        }
Exemple #7
0
        public static void BgKeyword_GivenValidColorNameEnum_ReturnsObjectWithBackgroundSet()
        {
            var expectedColor = new Rgb(143, 188, 143);
            var result        = Fabulous.BgKeyword(ColorKeyword.DarkSeaGreen);

            Assert.AreEqual(expectedColor, result.BackgroundColor);
        }
Exemple #8
0
        public static void Rgb_GivenValidColor_ReturnsObjectWithForegroundSet()
        {
            var expectedColor = new Rgb(12, 34, 56);

            var text = Fabulous.Rgb(12, 34, 56);

            Assert.AreEqual(expectedColor, text.ForegroundColor);
        }
Exemple #9
0
        public static void Hex_GivenValidHex_ReturnsObjectWithForegroundSet()
        {
            var expectedColor = new Rgb(143, 188, 143);

            var text = Fabulous.Hex("#8FBC8F");

            Assert.AreEqual(expectedColor, text.ForegroundColor);
        }
Exemple #10
0
        public static void BgKeyword_GivenValidColorName_ReturnsObjectWithBackgroundSet()
        {
            var expectedColor = new Rgb(143, 188, 143);

            var text = Fabulous.BgKeyword("DarkSeaGreen");

            Assert.AreEqual(expectedColor, text.BackgroundColor);
        }
Exemple #11
0
 public static void BgKeyword_GivenNullEmptyOrWhiteSpace_ThrowsArgNullException()
 {
     Assert.Multiple(() =>
     {
         Assert.Throws <ArgumentNullException>(() => Fabulous.BgKeyword(null));
         Assert.Throws <ArgumentNullException>(() => Fabulous.BgKeyword(string.Empty));
         Assert.Throws <ArgumentNullException>(() => Fabulous.BgKeyword("   "));
     });
 }
Exemple #12
0
        private static void Main()
        {
            FabulousConsole.ColorLevel = FabulousConsole.GetMaximumSupportedColorMode();
            var a1 = Fabulous
                     .Red
                     .BgHex("#00f")
                     .Underline
                     .Reset
                     .Text("abc");
            var a2 = Fabulous.Yellow.Text("def");
            var a3 = Fabulous
                     .Black
                     .BgWhiteBright
                     .Strikethrough
                     .Text("ghi");

            Fabulous.WriteLine(a1 + a2 + a3);

            Console.WriteLine();
            Console.WriteLine("Press any key to exit...");
            Console.ReadKey(true);
        }
Exemple #13
0
        public static void BgKeyword_GivenInvalidKeywordEnum_ThrowsArgNullException()
        {
            const ColorKeyword keyword = (ColorKeyword)293048;

            Assert.Throws <ArgumentException>(() => Fabulous.BgKeyword(keyword));
        }
 /// <summary>
 /// Writes the collection of styled text using the text representation of the specified array of objects to the standard error stream using the collection of styled text as the specified format information. The current line terminator will also be printed to the standard error stream afterwards.
 /// </summary>
 /// <param name="args">An array of objects to write using the styled text format.</param>
 public void WriteErrorLine(params object[] args) => Fabulous.WriteErrorLine(this, args);
 /// <summary>
 /// Asynchronously writes the collection of styled text using the text representation of the specified array of objects to the standard error stream using the collection of styled text as the specified format information. The current line terminator will also be asynchronously printed to the standard error stream afterwards.
 /// </summary>
 /// <param name="args">An array of objects to write using the styled text format.</param>
 /// <returns>A task that represents the asynchronous write operation.</returns>
 public Task WriteErrorLineAsync(params object[] args) => Fabulous.WriteErrorLineAsync(this, args);
 /// <summary>
 /// Asynchronously writes the collection of styled text followed by the current line terminator to the standard error stream.
 /// </summary>
 /// <returns>A task that represents the asynchronous write operation.</returns>
 public Task WriteErrorLineAsync() => Fabulous.WriteErrorLineAsync(this);
 /// <summary>
 /// Asynchronously writes the collection of styled text to the standard output stream.
 /// </summary>
 /// <returns>A task that represents the asynchronous write operation.</returns>
 public Task WriteAsync() => Fabulous.WriteAsync(this);
 /// <summary>
 /// Writes the collection of styled text to the standard error stream.
 /// </summary>
 public void WriteError() => Fabulous.WriteError(this);
 /// <summary>
 /// Writes the collection of styled text followed by the current line terminator to the standard error stream.
 /// </summary>
 public void WriteErrorLine() => Fabulous.WriteErrorLine(this);
Exemple #20
0
 public static void Background_NullColor_ThrowsArgNullException()
 {
     Assert.Throws <ArgumentNullException>(() => Fabulous.Background(null));
 }
 /// <summary>
 /// Writes the collection of styled text to the standard output stream.
 /// </summary>
 public void Write() => Fabulous.Write(this);