/// <summary> /// Creates an instance of <see cref="Sawyer"/> that is wired up with fake I/O classes for unit testing. /// </summary> /// <returns></returns> public Sawyer Create() { var addressQualityChecker = serviceProvider.GetRequiredService <AddressQualityChecker>(); GeocodeManager = new FakeGeocodeManager(); LocationCacheFactory = serviceProvider.GetRequiredService <FakeLocationCacheFactory>(); TreeParser = serviceProvider.GetRequiredService <TreeParser>(); TreeReader = new FakeTreeReader(); TreeWriter = new FakeTreeWriter(); return(new Sawyer(addressQualityChecker, GeocodeManager, LocationCacheFactory, null, TreeParser, TreeReader, TreeWriter)); }
/// <summary> /// Creates an instance of <see cref="Sawyer"/> that is wired up to real I/O but the cache and geocoders are all fake I/O classes for unit testing. /// </summary> /// <returns></returns> public Sawyer CreateWithLocalIO(string source, string destination) { var addressQualityChecker = serviceProvider.GetRequiredService <AddressQualityChecker>(); ReaderLogger = serviceProvider.GetRequiredService <FakeLogger <CsvTreeReader> >(); var reader = new CsvTreeReader(source, ReaderLogger); WriterLogger = serviceProvider.GetRequiredService <FakeLogger <JsonTreeWriter> >(); var writer = new JsonTreeWriter(WriterLogger, destination); GeocodeManager = new FakeGeocodeManager(); LocationCacheFactory = serviceProvider.GetRequiredService <FakeLocationCacheFactory>(); TreeParser = serviceProvider.GetRequiredService <TreeParser>(); return(new Sawyer(addressQualityChecker, GeocodeManager, LocationCacheFactory, null, TreeParser, reader, writer)); }