public void OptionsParseTest() { const string args = "-o directport=22" + ",ssh_command=cmd" + ",sftp_server=localhost" + ",max_read=12" + ",-1" + ",idmap=none" + ",idmap=user" + ",no_readahead"; bool a1 = false, a2 = false; int idmap1 = 0, idmap2 = 0; var options = new FuseOptions { { "directport=%u", u => Assert.Equal(22u, u) }, { "ssh_command=%s", s => Assert.Equal("cmd", s) }, { "-1", () => a1 = true }, { "idmap=none", 1, i => idmap1 = i }, { "idmap=user", 2, i => idmap2 = i }, { "no_readahead", () => a2 = true } }; var res = options.Parse(args.Split(' ')); Assert.True(res); Assert.True(a1); Assert.True(a2); Assert.Equal(1, idmap1); Assert.Equal(2, idmap2); }
public override void Init(FuseOptions options) { options.Add(Template, () => { Trace.WriteLine("FlagSetter.Action called"); _result = true; }); }
public void ArgsParseTest(Setter setter) { var options = new FuseOptions(); setter.Init(options); var result = options.Parse(setter.Args.Split(' ', StringSplitOptions.RemoveEmptyEntries)); Assert.True(result); Assert.True(setter.Success); }
public void Test1() { var input = new List <Book>(); input.Add(new Book { title = "The Code of The Wooster", author = "Bob James" }); input.Add(new Book { title = "The Wooster Code", author = "Rick Martin" }); input.Add(new Book { title = "The Code", author = "Jimmy Charles" }); input.Add(new Book { title = "Old Man's War", author = "John Scalzi" }); input.Add(new Book { title = "The Lock Artist", author = "Steve Hamilton" }); var opt = new FuseOptions <Book>(); opt.includeMatches = true; opt.includeScore = true; opt.keys.Add(new SearchKey <Book> { getter = b => b.author, weight = 1 }); opt.keys.Add(new SearchKey <Book> { getter = b => b.title, weight = 1 }); System.Diagnostics.Debugger.Launch(); //var output = Fuse<Book>.Search(input, "wooster", opt); var output = input.FuseSearch("wooster", opt); Assert.True(output.Count == 5); }
public void ExampleUsage1() { // Example copied from the docu of https://github.com/kurozael/Fuse.NET var input = new List <Book>(); input.Add(new Book { title = "The Code of The Wooster", author = "Bob James" }); input.Add(new Book { title = "The Wooster Code", author = "Rick Martin" }); input.Add(new Book { title = "The Code", author = "Jimmy Charles" }); input.Add(new Book { title = "Old Man's War", author = "John Scalzi" }); input.Add(new Book { title = "The Lock Artist", author = "Steve Hamilton" }); var opt = new FuseOptions(); opt.includeMatches = true; opt.includeScore = true; // Here we search through a list of `Book` types but you could search through just a list of strings. var fuse = new Fuse <Book>(input, opt); fuse.AddKey("title"); fuse.AddKey("author"); var searchResult = fuse.Search("woo"); searchResult.ForEach((FuseResult <Book> res) => { Log.d(res.item.title + ": " + res.item.author); Log.d("Search Result Score: " + res.score); if (res.matches != null) { res.matches.ForEach((b) => { Log.d("{Match}"); Log.d(b.key + ": " + b.value + " (Indicies: " + b.indicies.Count + ")"); }); } }); }
public override void Init(FuseOptions options) { options.Add(Template, s => _result = s); }
public abstract void Init(FuseOptions options);