public void StandardValidator_MarkedSpanEnd() { MarkedSpanEnd span; MarkedSpanStart startSpan; Segment segment; Unit unit; span = new MarkedSpanEnd(); Console.WriteLine("Test with StartReference matching sm."); span = new MarkedSpanEnd("spanId"); this.DeserializeDocument(); unit = (Unit)this._document.Files[0].Containers.First(c => c is Unit); unit.OriginalData = new OriginalData(); unit.OriginalData.AddData("dataId", "text"); segment = (Segment)unit.Resources.First(r => r is Segment); startSpan = new MarkedSpanStart("smId"); startSpan.Type = "term"; segment.Source.Text.Add(startSpan); segment.Source.Text.Add(span); span.StartReference = "smId"; StandardValidatorTests._validator.Validate(this._document); Console.WriteLine("Test with StartReference not matching sm."); span.StartReference = "bogus"; this.VerifyValidationException(ValidationError.TagStartRefInvalid); Console.WriteLine("Test with StartReference is null."); span.StartReference = null; this.VerifyValidationException(ValidationError.MarkedSpanEndStartRefNull); Console.WriteLine("Test with StartReference is empty."); span.StartReference = String.Empty; this.VerifyValidationException(ValidationError.MarkedSpanEndStartRefNull); }
/// <summary> /// Creates a <see cref="MarkedSpanEnd"/> with every element and attribute. /// </summary> /// <param name="startRef">The reference to the start tag.</param> /// <returns>The created <see cref="MarkedSpanEnd"/>.</returns> private MarkedSpanEnd CreateEm(string startRef) { MarkedSpanEnd result; result = new MarkedSpanEnd(startRef); return result; }