public void Should_find_basic_namespace() { var cache = new Fake_CacheBuilder(); _parser = new CSharpFileParser(cache); _parser.ParseFile("TestFile", () => { return "namespace MyFirstNS {}"; }); var ns = cache.Namespaces.ElementAt(0); Assert.That(ns.File, Is.EqualTo("TestFile")); Assert.That(ns.Signature, Is.EqualTo("MyFirstNS")); Assert.That(ns.Name, Is.EqualTo("MyFirstNS")); Assert.That(ns.Offset, Is.EqualTo(11)); Assert.That(ns.Line, Is.EqualTo(1)); Assert.That(ns.Column, Is.EqualTo(12)); }
public void Should_crawl_this_project() { var cache = new Fake_CacheBuilder(); new CSharpCrawler(cache) .Crawl(new CrawlOptions(new PathParser(string.Format("..{0}..{0}", Path.DirectorySeparatorChar)).ToAbsolute(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)))); Thread.Sleep(1500); Assert.That(cache.Classes.Count, Is.GreaterThan(0)); Assert.That(cache.Namespaces[0].Name, Is.EqualTo("CSharp.Tests.Crawlers")); Assert.That(cache.Namespaces[0].Line, Is.EqualTo(10)); Assert.That(cache.Namespaces[0].Column, Is.EqualTo(11)); Assert.That(cache.Classes[0].Name, Is.EqualTo("CSharpCommentParserTests")); Assert.That(cache.Classes[0].Signature, Is.EqualTo("CSharp.Tests.Crawlers.CSharpCommentParserTests")); Assert.That(cache.Classes[0].Line, Is.EqualTo(13)); Assert.That(cache.Classes[0].Column, Is.EqualTo(15)); Assert.That(cache.Classes.Exists(x => x.Name.Equals("Fake_CacheBuilder")), Is.True); }
public void Setup() { _cache = new Fake_CacheBuilder(); _parser = new CSharpFileParser(_cache); _parser.ParseFile("file1", () => { return getContent(); }); }