public void FilterString_1() { var rm = new ReaderManager(); rm.FilterString.Is("All files|*.*"); rm.Add(new Reader1()); rm.FilterString.Is("All known files|*.foo;*.bar|Foo file|*.foo|Bar file|*.bar|All files|*.*"); rm.Add(new Reader2()); rm.FilterString.Is("All known files|*.foo;*.bar;*.j;*.john;*.doe|Foo file|*.foo|Bar file|*.bar|john doe|*.j;*.john;*.doe|All files|*.*"); }
public void Add_1() { var rm = new ReaderManager(); rm.AsEnumerable().Count().Is(0); rm.Add(new Reader1()); rm.AsEnumerable().Count().Is(1); rm.Add(new Reader2()); rm.AsEnumerable().Count().Is(2); }
public void Reader_FilterIndex_1() { var rm = new ReaderManager(); rm.Add(new Reader1()); rm.Add(new Reader2()); // Reader1 and Reader2 have priorities 1 and 2 respectively, so // Reader1 will be listed first in the filter, but // Reader2 will be considered first when auto-detecting. rm.Read("filename").Assets.ElementAt(0).Original.Is("Reader2.-1"); rm.Read("filename", 0).Assets.ElementAt(0).Original.Is("Reader2.-1"); rm.Read("filename", 1).Assets.ElementAt(0).Original.Is("Reader1.0"); rm.Read("filename", 2).Assets.ElementAt(0).Original.Is("Reader1.1"); rm.Read("filename", 3).Assets.ElementAt(0).Original.Is("Reader2.0"); rm.Read("filename", 4).Assets.ElementAt(0).Original.Is("Reader2.-1"); AssertEx.Catch <ArgumentOutOfRangeException>(() => rm.Read("filename", -2)); AssertEx.Catch <ArgumentOutOfRangeException>(() => rm.Read("filename", 6)); }
/// <summary> /// Init readers managers /// </summary> private static void InitReadersManagers() { // Add PCSC reader manager IReader pcsc = new PcscReader(); ReaderManager.Add(pcsc.TypeName, pcsc); // Add SmartMouse reader manager IReader smouse = new SmartMouseReader(); ReaderManager.Add(smouse.TypeName, smouse); }