public void OneReference() { const string Code = @"class A { void B() { resMgr.GetString(""TestKey""); } }"; AnyResourceReferenceFinder finder = CreateFinder(); Assert.AreEqual(33, finder.GetNextPossibleOffset("a.cs", Code, -1), "Incorrect offset."); Assert.AreEqual(-1, finder.GetNextPossibleOffset("a.cs", Code, 33), "Incorrect offset."); }
public void FourReferencesMixed() { const string Code = @"class A { void B() { resMgr.GetString(""TestKey""); X(""${res:TestKey2}""); resMgr[""TestKey""]; X(""${res:TestKey3}""); } }"; AnyResourceReferenceFinder finder = CreateFinder(); Assert.AreEqual(33, finder.GetNextPossibleOffset("a.cs", Code, -1), "Incorrect offset."); Assert.AreEqual(61, finder.GetNextPossibleOffset("a.cs", Code, 33), "Incorrect offset."); Assert.AreEqual(89, finder.GetNextPossibleOffset("a.cs", Code, 61), "Incorrect offset."); Assert.AreEqual(108, finder.GetNextPossibleOffset("a.cs", Code, 89), "Incorrect offset."); Assert.AreEqual(-1, finder.GetNextPossibleOffset("a.cs", Code, 108), "Incorrect offset."); }
public void NoReference() { const string Code = @"class A { void B() { DoSomething(); } }"; AnyResourceReferenceFinder finder = CreateFinder(); Assert.AreEqual(-1, finder.GetNextPossibleOffset("a.cs", Code, -1), "Incorrect offset."); }