public static IObservable <Report> Create(PingConfig config) { string host = config.Host; int rate = config.Rate * 1000; int timeout = config.Timeout * 1000; return(Pinger.Create(host, rate, timeout)); }
public static IObservable <Report> Build(HostConfig conf) { switch (conf) { case PingConfig p: return(Pinger.Create(p)); case TcpConfig t: switch (t) { case HttpConfig h: return(HttpConnector.Create(h)); default: return(TcpConnector.Create(t)); } default: throw new ArgumentException($"Unsupported HostConfig type: {conf.GetType()}"); } }