public void ResolvePath_Initial() { var res = new MockSwFilePathResolverBase(new string[0], p => p == @"C:\zz\yy\xx\p2.sldprt", () => ""); var p1 = res.ResolvePath(@"D:\ss\tt\a1.sldasm", @"C:\zz\yy\xx\p2.sldprt"); Assert.AreEqual(@"C:\zz\yy\xx\p2.sldprt", p1); }
public void ResolvePath_Test() { var res = new MockSwFilePathResolverBase(new string[] { @"D:\aa\bb\", @"E:\cc\dd\" }, p => p == @"E:\yy\xx\p2.sldprt", () => ""); var p1 = res.ResolvePath(@"D:\ss\tt\a1.sldasm", @"C:\zz\yy\xx\p2.sldprt"); Assert.AreEqual(@"E:\yy\xx\p2.sldprt", p1); }
public void ResolvePath_AllRoutes() { var paths = new List <string>(); var res = new MockSwFilePathResolverBase(new string[] { @"D:\aa\bb\", @"E:\cc\dd\" }, p => { paths.Add(p); return(false); }, () => ""); var expPaths = new string[] { @"D:\aa\bb\p2.sldprt", @"D:\aa\bb\xx\p2.sldprt", @"D:\aa\bb\yy\xx\p2.sldprt", @"D:\aa\bb\zz\yy\xx\p2.sldprt", @"D:\aa\xx\p2.sldprt", @"D:\aa\yy\xx\p2.sldprt", @"D:\aa\zz\yy\xx\p2.sldprt", @"D:\xx\p2.sldprt", @"D:\yy\xx\p2.sldprt", @"D:\zz\yy\xx\p2.sldprt", @"E:\cc\dd\p2.sldprt", @"E:\cc\dd\xx\p2.sldprt", @"E:\cc\dd\yy\xx\p2.sldprt", @"E:\cc\dd\zz\yy\xx\p2.sldprt", @"E:\cc\xx\p2.sldprt", @"E:\cc\yy\xx\p2.sldprt", @"E:\cc\zz\yy\xx\p2.sldprt", @"E:\xx\p2.sldprt", @"E:\yy\xx\p2.sldprt", @"E:\zz\yy\xx\p2.sldprt", @"D:\ss\tt\p2.sldprt", @"D:\ss\tt\xx\p2.sldprt", @"D:\ss\tt\yy\xx\p2.sldprt", @"D:\ss\tt\zz\yy\xx\p2.sldprt", @"D:\ss\xx\p2.sldprt", @"D:\ss\yy\xx\p2.sldprt", @"D:\ss\zz\yy\xx\p2.sldprt", @"D:\xx\p2.sldprt", @"D:\yy\xx\p2.sldprt", @"D:\zz\yy\xx\p2.sldprt", @"C:\zz\yy\xx\p2.sldprt" }; Assert.Throws <FilePathResolveFailedException>(() => res.ResolvePath(@"D:\ss\tt\a1.sldasm", @"C:\zz\yy\xx\p2.sldprt")); Assert.That(expPaths.SequenceEqual(paths)); }