Skip to content

Commit

Permalink
Add test to prove deserialisation works with empty custom properties.
Browse files Browse the repository at this point in the history
Updates for new version release.
  • Loading branch information
Troy Willmot committed May 9, 2017
1 parent 454838b commit 7e206cd
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Main/PublishNugetPackage.cmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@echo off
echo Press any key to publish
pause
".nuget\NuGet.exe" push Rssdp.3.0.1.nupkg -Source https://www.nuget.org/api/v2/package
".nuget\NuGet.exe" push Rssdp.3.0.2.nupkg -Source https://www.nuget.org/api/v2/package
pause
4 changes: 2 additions & 2 deletions src/Main/Rssdp.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>Rssdp</id>
<version>3.0.1</version>
<version>3.0.2</version>
<title>Rssdp</title>
<authors>Troy Willmot</authors>
<owners>Yortw</owners>
Expand All @@ -12,7 +12,7 @@
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Really Simple Service Discovery Protocol - a 100% .Net implementation of the SSDP protocol for publishing custom/basic devices, and discovering all device types on a network.</description>
<summary>A 100% .Net implementation of the SSDP protocol for basic and custom device types.</summary>
<releaseNotes>Prevent unhandled/uncatchable background thread exceptions crashing calling app.</releaseNotes>
<releaseNotes>Fix for deserialisation problems when a custom property with an empty value exists in the device description document.</releaseNotes>
<copyright>Copyright 2017</copyright>
<language>en-AU</language>
<tags>portable xamarin ios android windowsphone winrt uwp mobile ssdp discovery device service protocol upnp netfx40 .net4</tags>
Expand Down
4 changes: 2 additions & 2 deletions src/Main/Shared/AssemblyInfoCommon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
[assembly: AssemblyCopyright("Released under the MIT license; http://choosealicense.com/licenses/mit/; https://github.com/Yortw/RSSDP")]
[assembly: AssemblyTrademark("")]

[assembly: AssemblyVersion("3.0.1.0")]
[assembly: AssemblyFileVersion("3.0.1.0")]
[assembly: AssemblyVersion("3.0.2.0")]
[assembly: AssemblyFileVersion("3.0.2.0")]
2 changes: 1 addition & 1 deletion src/Main/Test.SsdpPortable/DeviceDeserialisationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ public void RootDeviceDeserialisationConstructor_ThrowsOnLocation()
{
var rootDevice = new SsdpRootDevice(null, TimeSpan.FromMinutes(30), "<root />");
}

private void AssertDevicesAreSame(SsdpRootDevice originalDevice, SsdpRootDevice deserialisedDevice)
{
Assert.AreEqual(originalDevice.CacheLifetime, deserialisedDevice.CacheLifetime);
Expand Down
39 changes: 39 additions & 0 deletions src/Main/Test.SsdpPortable/SsdpDeviceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,45 @@ public void SsdpDevice_Constructor_DeserialisesComplexDeviceDocumentAndSkipsComp
Assert.IsFalse(subDevice.CustomProperties.Contains("X_Rhapsody-Extension"));
}

[TestMethod]
public void DeserialisationHandlesEmptyCustomProperties()
{
//See issue #70 in repo - empty custom properties would cause
//all following properties to be skipped.

var docString = @"<?xml version=""1.0"" encoding=""UTF-8""?>
<root xmlns=""urn:schemas-upnp-org:device-1-0"">
<specVersion>
<major>1</major>
<minor>0</minor>
</specVersion>
<device>
<deviceType>urn:schemas-upnp-org:device:MediaServer:1</deviceType>
<UDN>uuid:55076f6e-6b79-1d65-a472-00059a3c7a00</UDN>
<friendlyName>Twonky :)</friendlyName>
<pv:extension xmlns:pv=""http://www.pv.com/pvns/""></pv:extension>
<manufacturer>PacketVideo</manufacturer>
<manufacturerURL>http://www.pv.com</manufacturerURL>
<modelName>TwonkyServer</modelName>
<modelURL>http://www.twonky.com</modelURL>
<modelDescription>TwonkyServer (Windows, T-206)</modelDescription>
<modelNumber>8.4</modelNumber>
<serialNumber>8.4</serialNumber>
</device>
</root>";


var device = new SsdpRootDevice(new Uri("http://192.168.1.11/UPnP/DeviceDescription"), TimeSpan.FromMinutes(30), docString);
Assert.IsFalse(device.CustomProperties.Contains("pv:extension"));
Assert.AreEqual(device.Manufacturer, "PacketVideo");
Assert.AreEqual(device.ManufacturerUrl, "http://www.pv.com");
Assert.AreEqual(device.ModelName, "TwonkyServer");
Assert.AreEqual(device.ModelUrl, "http://www.twonky.com");
Assert.AreEqual(device.ModelDescription, "TwonkyServer (Windows, T-206)");
Assert.AreEqual(device.ModelNumber, "8.4");
Assert.AreEqual(device.SerialNumber, "8.4");
}

#endregion

#region Service Tests
Expand Down

0 comments on commit 7e206cd

Please sign in to comment.