Exemplo n.º 1
0
 public void Equality()
 {
     for (int i = 0; i < numberoftrials; i++)
     {
         SourceRange a = RandomSourceRange();
         SourceRange b = new SourceRange(a.Min, a.Max);
         Assert.IsTrue(a == b);
         Assert.IsTrue(a.Equals(b));
         Assert.AreEqual(a, b);
         Assert.IsFalse(a != b);
         Assert.AreNotSame(a, b);
     }
 }
Exemplo n.º 2
0
        public void NullEquality()
        {
            SourceRange a = RandomSourceRange();
            SourceRange b = null;

            Assert.AreNotEqual(a, b);
            Assert.IsFalse(a == b);
            Assert.IsFalse(a == null);
            Assert.IsTrue(b == null);
            Assert.IsFalse(a.Equals(b));
            Assert.IsTrue(a != b);
            Assert.IsTrue(a != null);
            Assert.IsFalse(b != null);
        }
Exemplo n.º 3
0
 public bool Equals(LinesRangeDiffResult other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     //Trying to short circuit with simple comparisons first.
     return(SourceRange.Equals(other.SourceRange) && TargetRange.Equals(other.TargetRange) &&
            DiffStatus == other.DiffStatus && AffectedLines.Count == other.AffectedLines.Count &&
            AffectedLines.SequenceEqual(other.AffectedLines));
 }
        private bool IsValidSelection(LanguageElement element, TextViewSelection selection, SourceRange signatureRange)
        {
            if ((element == null) || (selection == null))
            {
                return false;
            }

            return (!selection.Exists || (element.Range.Equals(selection.Range) || ((element.Range.Start.Equals(selection.Range.End) && element.Range.End.Equals(selection.Range.Start)) || (signatureRange.Equals(selection.Range) || (signatureRange.Start.Equals(selection.Range.End) && signatureRange.End.Equals(selection.Range.Start))))));
        }
Exemplo n.º 5
0
        private bool IsValidSelection(LanguageElement element, TextViewSelection selection, SourceRange signatureRange)
        {
            if ((element == null) || (selection == null))
            {
                return(false);
            }

            return(!selection.Exists || (element.Range.Equals(selection.Range) || ((element.Range.Start.Equals(selection.Range.End) && element.Range.End.Equals(selection.Range.Start)) || (signatureRange.Equals(selection.Range) || (signatureRange.Start.Equals(selection.Range.End) && signatureRange.End.Equals(selection.Range.Start))))));
        }