public static string ToXmlContent(this CommonLinkProperties source) { var sb = new StringBuilder(); sb.AppendHeader(); sb.AppendValue("New" + nameof(source.WANAccessType), source.WANAccessType); sb.AppendValue("New" + nameof(source.Layer1UpstreamMaxBitRate), source.Layer1UpstreamMaxBitRate); sb.AppendValue("New" + nameof(source.Layer1DownstreamMaxBitRate), source.Layer1DownstreamMaxBitRate); sb.AppendValue("New" + nameof(source.PhysicalLinkStatus), source.PhysicalLinkStatus); sb.AppendFooter(); return(sb.ToString()); }
public async Task GetCommonLinkPropertiesAsync_Test1() { var expected = new CommonLinkProperties { WANAccessType = "DSL", Layer1UpstreamMaxBitRate = 1024, Layer1DownstreamMaxBitRate = 6192, PhysicalLinkStatus = "Up", }; var handler = new FakeHandler(); handler.Sending += (s, e) => { e.Response.Content = new StringContent(expected.ToXmlContent()); }; var clt = new WANCommonInterfaceConfigClient("https://fritz.box:453", 5000, handler); var result = await clt.GetCommonLinkPropertiesAsync().ConfigureAwait(false); Assert.Equal(expected.WANAccessType, result.WANAccessType); Assert.Equal(expected.Layer1UpstreamMaxBitRate, result.Layer1UpstreamMaxBitRate); Assert.Equal(expected.Layer1DownstreamMaxBitRate, result.Layer1DownstreamMaxBitRate); Assert.Equal(expected.PhysicalLinkStatus, result.PhysicalLinkStatus); }