public void WhenIpAddressAndPathAreValid_ThenSet() { var sut = new SonosUri(ValidIpAddress, ValidPath); Assert.That(sut.IpAddress, Is.EqualTo(ValidIpAddress)); Assert.That(sut.Path, Is.EqualTo(ValidPath)); }
public async Task <string> GetDeviceDescriptionXmlAsync(string ipAddress) { var uri = new SonosUri(ipAddress, "xml/device_description.xml").ToUri(); var response = await HttpClient.GetAsync(uri); return(await response.Content.ReadAsStringAsync()); }
public async Task <HttpResponseMessage> RebootAsync(string ipAddress) { using (var client = new HttpClient()) { var uri = new SonosUri(ipAddress, "reboot").ToUri(); return(await client.GetAsync(uri)); } }
public void WhenCalled_ThenReturnsUri() { var expected = new Uri($"http://{ValidIpAddress}:{SonosUri.PortNumber}/{ValidPath}"); var sut = new SonosUri(ValidIpAddress, ValidPath); var result = sut.ToUri(); Assert.That(result, Is.EqualTo(expected)); }
public void WhenPathNoSlashPrefix_ThenSetPath() { var sut = new SonosUri(ValidIpAddress, ValidPath); Assert.That(sut.Path, Is.EqualTo(ValidPath)); }
public void WhenPathHasSlashPrefix_ThenSetPathWithoutSlash() { var sut = new SonosUri(ValidIpAddress, "/somepath"); Assert.That(sut.Path, Is.EqualTo("somepath")); }
public void WhenPathIsNull_ThenSetPathToEmpty() { var sut = new SonosUri(ValidIpAddress, null); Assert.That(sut.Path, Is.Empty); }
public RenderingControlService(string ipAddress) { var upnpUri = new SonosUri(ipAddress, ControlUrl); _upnpClient = new UpnpClient(upnpUri.ToUri(), ActionNamespace); }