Ejemplo n.º 1
0
        public static void AdditionOp_GivenTwoCollectionsWithSecondCollectionNull_ThrowsArgNullException()
        {
            FabulousTextCollection collectionA = "abc";
            FabulousTextCollection collectionB = null;

            Assert.Throws <ArgumentNullException>(() => _ = collectionA + collectionB);
        }
Ejemplo n.º 2
0
        public static void AdditionOp_GivenTextThenCollectionWithNullText_ThrowsArgNullException()
        {
            FabulousTextCollection collection = "abc";
            FabulousText           text       = null;

            Assert.Throws <ArgumentNullException>(() => _ = text + collection);
        }
Ejemplo n.º 3
0
        public static void AdditionOp_GivenCollectionThenTextWithNullCollection_ThrowsArgNullException()
        {
            FabulousTextCollection collection = null;
            FabulousText           text       = "abc";

            Assert.Throws <ArgumentNullException>(() => _ = collection + text);
        }
Ejemplo n.º 4
0
        public static void ImplicitOp_GivenFabulousText_CreatesViaCtor()
        {
            FabulousText           text       = "abc";
            FabulousTextCollection collection = text;

            var collectionText = collection.Fragments.Single();

            Assert.AreEqual(text.Text, collectionText.Text);
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
0
        public static void AdditionOp_GivenTwoCollections_AddsInCorrectOrder()
        {
            FabulousTextCollection abc = "abc";
            FabulousTextCollection def = "def";

            var combined     = abc + def;
            var combinedText = string.Concat(combined.Fragments.Select(t => t.Text));
            var expected     = abc.Fragments.Single().Text + def.Fragments.Single().Text;

            Assert.IsTrue(expected == combinedText);
        }
Ejemplo n.º 7
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);
        }
Ejemplo n.º 8
0
        public static void AdditionOp_GivenTextThenCollection_AddsInCorrectOrder()
        {
            FabulousText abc        = "abc";
            FabulousText def        = "def";
            var          collection = new FabulousTextCollection(abc, def);

            FabulousText ghi          = "ghi";
            var          combined     = collection + ghi;
            var          combinedText = string.Concat(combined.Fragments.Select(t => t.Text));
            var          expected     = abc.Text + def.Text + ghi.Text;

            Assert.IsTrue(expected == combinedText);
        }