Line fixed length.
Inheritance: ObservableObject
Ejemplo n.º 1
0
        public void Flags_On_Set_Notify_Events_Are_Raised()
        {
            var state = new LineFixedLength();
            var target = new PropertyChangedObserver(state);

            state.Flags = 
                LineFixedLengthFlags.Start 
                | LineFixedLengthFlags.Vertical 
                | LineFixedLengthFlags.Horizontal;

            Assert.Equal(
                LineFixedLengthFlags.Start 
                | LineFixedLengthFlags.Vertical 
                | LineFixedLengthFlags.Horizontal, state.Flags);
            Assert.Equal(7, target.PropertyNames.Count);

            var propertyNames = new string[]
            {
                nameof(LineFixedLength.Flags),
                nameof(LineFixedLength.Disabled),
                nameof(LineFixedLength.Start),
                nameof(LineFixedLength.End),
                nameof(LineFixedLength.Vertical),
                nameof(LineFixedLength.Horizontal),
                nameof(LineFixedLength.All)
            };

            Assert.Equal(propertyNames, target.PropertyNames);
        }
Ejemplo n.º 2
0
        public void Parse_LineFixedLengthFlags_String()
        {
            var target = LineFixedLength.Parse("Start, Vertical, Horizontal");

            Assert.Equal(
                LineFixedLengthFlags.Start
                | LineFixedLengthFlags.Vertical
                | LineFixedLengthFlags.Horizontal, target.Flags);
        }
Ejemplo n.º 3
0
        public void End_Property()
        {
            var target = new LineFixedLength();

            target.End = true;
            Assert.Equal(LineFixedLengthFlags.End, target.Flags);

            target.End = false;
            Assert.Equal(LineFixedLengthFlags.Disabled, target.Flags);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Creates a new <see cref="LineStyle"/> instance.
 /// </summary>
 /// <param name="name">The line style name.</param>
 /// <param name="isCurved">The flag indicating whether line is curved.</param>
 /// <param name="curvature">The line curvature.</param>
 /// <param name="curveOrientation">The curve orientation.</param>
 /// <param name="fixedLength">The line style fixed length.</param>
 /// <returns>The new instance of the <see cref="LineStyle"/> class.</returns>
 public static LineStyle Create(
     string name      = "",
     bool isCurved    = false,
     double curvature = 50.0,
     CurveOrientation curveOrientation = CurveOrientation.Auto,
     LineFixedLength fixedLength       = null)
 {
     return(new LineStyle()
     {
         Name = name,
         IsCurved = isCurved,
         Curvature = curvature,
         CurveOrientation = curveOrientation,
         FixedLength = fixedLength ?? LineFixedLength.Create()
     });
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Creates a new <see cref="LineStyle"/> instance.
 /// </summary>
 /// <param name="name">The line style name.</param>
 /// <param name="isCurved">The flag indicating whether line is curved.</param>
 /// <param name="curvature">The line curvature.</param>
 /// <param name="curveOrientation">The curve orientation.</param>
 /// <param name="fixedLength">The line style fixed length.</param>
 /// <returns>The new instance of the <see cref="LineStyle"/> class.</returns>
 public static LineStyle Create(
     string name = "", 
     bool isCurved = false, 
     double curvature = 50.0, 
     CurveOrientation curveOrientation = CurveOrientation.Auto, 
     LineFixedLength fixedLength = null)
 {
     return new LineStyle()
     {
         Name = name,
         IsCurved = isCurved,
         Curvature = curvature,
         CurveOrientation = curveOrientation,
         FixedLength = fixedLength ?? LineFixedLength.Create()
     };
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Parses a line fixed length string.
        /// </summary>
        /// <param name="s">The line fixed length string.</param>
        /// <returns>The <see cref="LineFixedLength"/>.</returns>
        public static LineFixedLength Parse(string s)
        {
            var flags = (LineFixedLengthFlags)Enum.Parse(typeof(LineFixedLengthFlags), s, true);

            return(LineFixedLength.Create(flags));
        }
Ejemplo n.º 7
0
        public void Vertical_Property()
        {
            var target = new LineFixedLength();

            target.Vertical = true;
            Assert.Equal(LineFixedLengthFlags.Vertical, target.Flags);

            target.Vertical = false;
            Assert.Equal(LineFixedLengthFlags.Disabled, target.Flags);
        }
Ejemplo n.º 8
0
 public void Inherits_From_ObservableObject()
 {
     var target = new LineFixedLength();
     Assert.True(target is ObservableObject);
 }