/// <inheritdoc/>
        public int CompareTo(ImplementationVersion?other)
        {
            #region Sanity checks
            if (ReferenceEquals(null, other))
            {
                throw new ArgumentNullException(nameof(other));
            }
            #endregion

            int firstPartCompared = FirstPart.CompareTo(other.FirstPart);
            if (firstPartCompared != 0)
            {
                return(firstPartCompared);
            }

            int leastNumberOfAdditionalParts = Math.Max(AdditionalParts.Count, other.AdditionalParts.Count);
            for (int i = 0; i < leastNumberOfAdditionalParts; ++i)
            {
                var left             = i >= AdditionalParts.Count ? VersionPart.Default : AdditionalParts[i];
                var right            = i >= other.AdditionalParts.Count ? VersionPart.Default : other.AdditionalParts[i];
                int comparisonResult = left.CompareTo(right);
                if (comparisonResult != 0)
                {
                    return(comparisonResult);
                }
            }
            return(0);
        }
Example #2
0
 public override string ToSource()
 {
     return(string.Format
            (
                "({0}.Is{1}Than({2}))",
                FirstPart.ToSource(),
                ConditionText,
                SecondPart.ToSource()
            ));
 }
Example #3
0
        public override string ToSource()
        {
            string firstPartStr  = FirstPart?.ToSource();
            string secondPartStr = SecondPart?.ToSource();

            if (!(FirstPart is GString))
            {
                firstPartStr += ".ToText()";
            }

            if (!(SecondPart is GString))
            {
                secondPartStr += ".ToText()";
            }

            return(string.Format("({0} + {1})", firstPartStr, secondPartStr));
        }
Example #4
0
        public override string ToSource()
        {
            string firstPartStr  = FirstPart?.ToSource();
            string secondPartStr = SecondPart?.ToSource();

            if (!(FirstPart is GNumber))
            {
                firstPartStr += ".ToNumber()";
            }

            if (!(SecondPart is GNumber))
            {
                secondPartStr += ".ToNumber()";
            }

            return(string.Format("({0} {1} {2})", firstPartStr, OperatorText, secondPartStr));
        }
Example #5
0
        public void CreateManyParametersTest()
        {
            FirstPart  f = new FirstPart();
            SecondPart s = new SecondPart();

            f.FirstName = "John";
            s.LastName  = "Pupkin";

            using (DbManager db = new DbManager())
            {
                Person p = (Person)db
                           .SetSpCommand("Person_SelectByName", db.CreateParameters(f), db.CreateParameters(s))
                           .ExecuteObject(typeof(Person));

                Assert.IsNotNull(p);
                Assert.AreEqual(f.FirstName, p.FirstName);
                Assert.AreEqual(s.LastName, p.LastName);
            }
        }
Example #6
0
        public void MoveSnake()
        {
            //change how the snake looks given the new direction.
            if (parts.Count == 1)
            {
                FirstPart.MoveSnakePart();
            }
            else if (parts.Count > 1)
            {
                //shrink the end of the last part
                LastPart.Length -= 1;

                //increase the length of the first one
                FirstPart.Length += 1;

                if (LastPart.Length == 0)
                {
                    parts.Remove(LastPart);
                }

                FirstPart.MoveSnakePart();
            }
        }
Example #7
0
        public override string ToSource()
        {
            string firstPartStr  = FirstPart?.ToSource();
            string secondPartStr = SecondPart?.ToSource();

            if (!(FirstPart is GLogic))
            {
                firstPartStr += ".ToBool()";
            }

            if (!(SecondPart is GLogic))
            {
                secondPartStr += ".ToBool()";
            }


            return(string.Format
                   (
                       "({0} {1} {2})",
                       firstPartStr,
                       GateText,
                       secondPartStr
                   ));
        }
Example #8
0
		public void CreateManyParametersTest()
		{
			FirstPart  f = new FirstPart();
			SecondPart s = new SecondPart();

			f.FirstName = "John";
			s.LastName = "Pupkin";

			using (DbManager db = new DbManager())
			{
				Person p = (Person)db
					.SetSpCommand ("Person_SelectByName", db.CreateParameters(f), db.CreateParameters(s))
					.ExecuteObject(typeof(Person));
				
				Assert.IsNotNull(p);
				Assert.AreEqual(f.FirstName, p.FirstName);
				Assert.AreEqual(s.LastName,  p.LastName);
			}
		}