示例#1
0
        public void ContainStrength_FromCreation()
        {
            var strength        = 10;
            var mdConvertedItem = new MdConvertedItem(Direction.BothSides, new List <MdSelectionType>(), strength);

            mdConvertedItem.ResidualStrength.Should().Be(strength);
        }
示例#2
0
        public void ContainDirection_FromCreation()
        {
            var expectedDirection = Direction.Left;
            var mdConvertedItem   = new MdConvertedItem(expectedDirection, new List <MdSelectionType>(), 1);

            mdConvertedItem.Direction.Should().Be(expectedDirection);
        }
        public void ConvertText_RaisesException_IfNotEnoughSelection()
        {
            var textParts  = new[] { new TextPart("a", TextType.SpecialSymbols) };
            var selections = new MdConvertedItem[] {};

            Assert.Throws <ArgumentException>(() => converterMd.ConvertText(textParts, selections));
        }
示例#4
0
        public void Strength_ShouldNotChange_WhenCreatedAnotherMdConvertedItem()
        {
            var strength   = 10;
            var firstItem  = new MdConvertedItem(Direction.Left, new List <MdSelectionType>(), strength);
            var secondItem = new MdConvertedItem(Direction.Left, new List <MdSelectionType>(), 4);

            firstItem.ResidualStrength.Should().Be(strength);
        }
示例#5
0
        public void Direction_ShouldNotChange_WhenCreatedAnotherMdConvertedItem()
        {
            var direction  = Direction.Left;
            var firstItem  = new MdConvertedItem(direction, new List <MdSelectionType>(), 10);
            var secondItem = new MdConvertedItem(Direction.Right, new List <MdSelectionType>(), 11);

            firstItem.Direction.Should().Be(direction);
        }
示例#6
0
        public void Selections_ShouldNotChange_WhenCreatedAnotherMdConvertedItem()
        {
            var selections = new[] { MdSelectionType.Italic, MdSelectionType.Bold };
            var firstItem  = new MdConvertedItem(Direction.Left, selections, 10);
            var secondItem = new MdConvertedItem(Direction.Right, new List <MdSelectionType>(), 11);

            firstItem.Selections.Should().BeEquivalentTo(selections,
                                                         assertionsOptions => assertionsOptions.WithStrictOrdering());
        }
示例#7
0
        public void ContainSelections_FromCreation()
        {
            var selections = new List <MdSelectionType>()
            {
                MdSelectionType.Italic, MdSelectionType.Italic
            };
            var mdConvertedItem = new MdConvertedItem(Direction.Left, selections, 10);

            mdConvertedItem.Selections.Should().BeEquivalentTo(selections,
                                                               assertionOptions => assertionOptions.WithStrictOrdering());
        }
        public void ToSafe_ReturnsCorrectItem()
        {
            var selections = new[] { MdSelectionType.Italic, MdSelectionType.Bold };
            var direction  = Direction.Left;
            var strength   = 3;

            var expectedItem = new MdConvertedItem(direction, selections, strength);
            var notSafeItem  = new MdConvertedItemNotSafe(strength);

            notSafeItem.Direction = direction;
            notSafeItem.Selections.AddRange(selections);
            var safeItem = notSafeItem.ToSafe();

            safeItem.Should().BeEquivalentTo(expectedItem,
                                             assertionsOptions => assertionsOptions.WithStrictOrdering());
        }