public void GeneratedCodeMappingsAreNotEqualIfStartLineIsNotEqual()
 {
     GeneratedCodeMapping left = new GeneratedCodeMapping(12, 34, 56, 87);
     GeneratedCodeMapping right = new GeneratedCodeMapping(21, 34, 56, 87);
     Assert.False(left == right);
     Assert.False(left.Equals(right));
     Assert.False(right.Equals(left));
     Assert.False(Equals(left, right));
 }
 public void GeneratedCodeMappingsAreEqualIfDataIsEqual()
 {
     GeneratedCodeMapping left = new GeneratedCodeMapping(12, 34, 56, 78);
     GeneratedCodeMapping right = new GeneratedCodeMapping(12, 34, 56, 78);
     Assert.True(left == right);
     Assert.True(left.Equals(right));
     Assert.True(right.Equals(left));
     Assert.True(Equals(left, right));
 }
Example #3
0
        public int AddCodeMapping(SourceLocation sourceLocation, int generatedCodeStart, int generatedCodeLength)
        {
            if (generatedCodeStart == Int32.MaxValue)
            {
                throw new ArgumentOutOfRangeException("generatedCodeStart");
            }

            GeneratedCodeMapping mapping = new GeneratedCodeMapping(
                startOffset: sourceLocation.AbsoluteIndex,
                startLine: sourceLocation.LineIndex + 1,
                startColumn: sourceLocation.CharacterIndex + 1,
                startGeneratedColumn: generatedCodeStart + 1,
                codeLength: generatedCodeLength);

            int id = _nextDesignTimePragmaId++;
            CodeMappings[id] = mapping;
            return id;
        }