public void TestGetResults() { string address = "127.0.0.1"; IAdapter adapter = new PingAdapter(new Ping()); Result result = adapter.GetResults(address); Assert.IsTrue(result.Data.TryGetValue(PingAdapter.Address, out string actualAddress)); Assert.AreEqual(address, actualAddress); }
public IAdapter GetAdapter(string adapterName) { IAdapter adapter; switch (adapterName) { case nameof(PingAdapter): adapter = new PingAdapter(new Ping()); break; case nameof(ReverseDNSAdapter): adapter = new ReverseDNSAdapter(); break; case nameof(GeoIPAdapter): adapter = new GeoIPAdapter(new GeoLocationProvider()); break; default: throw new InvalidOperationException($"No adapter found for service {adapterName}"); } return(adapter); }