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

            Assert.AreNotSame(text, result);
        }
Пример #2
0
        public static void AdditionOp_GivenTextThenCollectionWithNullText_ThrowsArgNullException()
        {
            FabulousTextCollection collection = "abc";
            FabulousText           text       = null;

            Assert.Throws <ArgumentNullException>(() => _ = text + collection);
        }
Пример #3
0
        public static void BgHex_GivenValidHex_ReturnsNewObject()
        {
            FabulousText text   = string.Empty;
            var          result = Fabulous.BgHex("#8FBC8F");

            Assert.AreNotSame(text, result);
        }
Пример #4
0
        public static void AdditionOp_GivenCollectionThenTextWithNullCollection_ThrowsArgNullException()
        {
            FabulousTextCollection collection = null;
            FabulousText           text       = "abc";

            Assert.Throws <ArgumentNullException>(() => _ = collection + text);
        }
Пример #5
0
        public static void BgKeyword_GivenValidColorNameEnum_ReturnsNewObject()
        {
            FabulousText text   = string.Empty;
            var          result = Fabulous.BgKeyword(ColorKeyword.DarkSeaGreen);

            Assert.AreNotSame(text, result);
        }
Пример #6
0
        public static void BgBlack_PropertyGet_ReturnsNewObject()
        {
            FabulousText text   = string.Empty;
            var          result = text.BgBlack;

            Assert.AreNotSame(text, result);
        }
Пример #7
0
        public static void Strikethrough_PropertyGet_ReturnsNewObject()
        {
            FabulousText text = string.Empty;

            var result = text.Strikethrough;

            Assert.AreNotSame(text, result);
        }
Пример #8
0
        public static void Underline_PropertyGet_ReturnsNewObject()
        {
            FabulousText text = string.Empty;

            var result = text.Underline;

            Assert.AreNotSame(text, result);
        }
Пример #9
0
        public static void Keyword_GivenInvalidKeywordEnum_ThrowsArgNullException()
        {
            FabulousText text = string.Empty;

            const ColorKeyword keyword = (ColorKeyword)293048;

            Assert.Throws <ArgumentException>(() => text.Keyword(keyword));
        }
Пример #10
0
        public static void WhiteBright_PropertyGet_ReturnsNewObject()
        {
            FabulousText text = string.Empty;

            var result = text.WhiteBright;

            Assert.AreNotSame(text, result);
        }
Пример #11
0
        public static void Cyan_PropertyGet_ReturnsNewObject()
        {
            FabulousText text = string.Empty;

            var result = Fabulous.Cyan;

            Assert.AreNotSame(text, result);
        }
Пример #12
0
        public static void Grey_PropertyGet_ReturnsObjectWithGreyForegroundColor()
        {
            FabulousText text          = string.Empty;
            var          expectedColor = new Rgb(128, 128, 128);

            var result = text.Grey;

            Assert.AreEqual(expectedColor, result.ForegroundColor);
        }
Пример #13
0
        public static void Rgb_GivenValidColor_ReturnsNewObjectWithForegroundSet()
        {
            var expectedColor = new Rgb(12, 34, 56);

            FabulousText text   = string.Empty;
            var          result = text.Rgb(12, 34, 56);

            Assert.AreEqual(expectedColor, result.ForegroundColor);
        }
Пример #14
0
        public static void ImplicitOp_GivenFabulousText_CreatesViaCtor()
        {
            FabulousText           text       = "abc";
            FabulousTextCollection collection = text;

            var collectionText = collection.Fragments.Single();

            Assert.AreEqual(text.Text, collectionText.Text);
        }
Пример #15
0
        public static void Hidden_PropertyGet_ReturnsObjectWithHiddenDecorationSet()
        {
            FabulousText         text     = string.Empty;
            const TextDecoration expected = TextDecoration.Hidden;

            var result = text.Hidden;

            Assert.AreEqual(expected, result.Decorations);
        }
Пример #16
0
        public static void Strikethrough_PropertyGet_ReturnsObjectWithStrikethroughDecorationSet()
        {
            FabulousText         text     = string.Empty;
            const TextDecoration expected = TextDecoration.Strikethrough;

            var result = text.Strikethrough;

            Assert.AreEqual(expected, result.Decorations);
        }
Пример #17
0
        public static void BgWhiteBright_PropertyGet_ReturnsObjectWithWhiteBrightBackgroundColor()
        {
            FabulousText text          = string.Empty;
            var          expectedColor = new Rgb(255, 255, 255);

            var result = text.BgWhiteBright;

            Assert.AreEqual(expectedColor, result.BackgroundColor);
        }
Пример #18
0
        public static void Underline_PropertyGet_ReturnsObjectWithUnderlineDecorationSet()
        {
            FabulousText         text     = string.Empty;
            const TextDecoration expected = TextDecoration.Underline;

            var result = text.Underline;

            Assert.AreEqual(expected, result.Decorations);
        }
Пример #19
0
        public static void BgMagenta_PropertyGet_ReturnsObjectWithMagentaBackgroundColor()
        {
            FabulousText text          = string.Empty;
            var          expectedColor = new Rgb(139, 0, 139);

            var result = text.BgMagenta;

            Assert.AreEqual(expectedColor, result.BackgroundColor);
        }
Пример #20
0
        public static void BgGrey_PropertyGet_ReturnsObjectWithGreyBackgroundColor()
        {
            FabulousText text          = string.Empty;
            var          expectedColor = new Rgb(169, 169, 169);

            var result = text.BgGrey;

            Assert.AreEqual(expectedColor, result.BackgroundColor);
        }
Пример #21
0
        public static void Text_GivenValidText_SetsTextOnNewObject()
        {
            FabulousText text = "xyz";

            const string replacement = "abc";
            var          result      = text.Text(replacement);

            Assert.AreEqual(replacement, result.Text);
        }
Пример #22
0
        public static void BgBlack_PropertyGet_ReturnsObjectWithBlackBackgroundColor()
        {
            FabulousText text          = string.Empty;
            var          expectedColor = new Rgb(0, 0, 0);

            var result = text.Black;

            Assert.AreEqual(expectedColor, result.BackgroundColor);
        }
Пример #23
0
        public static void CyanBright_PropertyGet_ReturnsObjectWithCyanBrightForegroundColor()
        {
            FabulousText text          = string.Empty;
            var          expectedColor = new Rgb(0, 255, 255);

            var result = text.CyanBright;

            Assert.AreEqual(expectedColor, result.ForegroundColor);
        }
Пример #24
0
        public static void Red_PropertyGet_ReturnsObjectWithRedForegroundColor()
        {
            FabulousText text          = string.Empty;
            var          expectedColor = new Rgb(139, 0, 0);

            var result = text.Red;

            Assert.AreEqual(expectedColor, result.ForegroundColor);
        }
Пример #25
0
        public static void White_PropertyGet_ReturnsObjectWithWhiteForegroundColor()
        {
            FabulousText text          = string.Empty;
            var          expectedColor = new Rgb(192, 192, 192);

            var result = text.White;

            Assert.AreEqual(expectedColor, result.ForegroundColor);
        }
Пример #26
0
        public static void BgYellow_PropertyGet_ReturnsObjectWithYellowBackgroundColor()
        {
            FabulousText text          = string.Empty;
            var          expectedColor = new Rgb(215, 195, 42);

            var result = text.BgYellow;

            Assert.AreEqual(expectedColor, result.BackgroundColor);
        }
Пример #27
0
        public static void Background_GivenValidArgs_CreatesNewObject()
        {
            FabulousText text = "xyz";

            var newBackground = Mock.Of <IColor>();
            var result        = text.Background(newBackground);

            Assert.AreNotSame(result, text);
        }
Пример #28
0
        public static void Fragments_PropertyGet_ReturnsFragments()
        {
            FabulousText abc       = "abc";
            FabulousText def       = "def";
            var          fragments = new[] { abc, def };

            var collection = new FabulousTextCollection(fragments);

            Assert.AreSame(fragments, collection.Fragments);
        }
Пример #29
0
        public static void ImplicitOp_GivenString_CreatesViaCtor()
        {
            const string abc  = "abc";
            FabulousText text = abc;

            FabulousTextCollection collection = abc;

            var collectionText = collection.Fragments.Single();

            Assert.AreEqual(text.Text, collectionText.Text);
        }
Пример #30
0
        public static void Keyword_GivenNullEmptyOrWhiteSpace_ThrowsArgNullException()
        {
            FabulousText text = string.Empty;

            Assert.Multiple(() =>
            {
                Assert.Throws <ArgumentNullException>(() => text.Keyword(null));
                Assert.Throws <ArgumentNullException>(() => text.Keyword(string.Empty));
                Assert.Throws <ArgumentNullException>(() => text.Keyword("   "));
            });
        }