public void testSIFRegisterZISVersion15r1() { Adk.SifVersion = (SifVersion.LATEST); String iconURL = "http://acme.foo.bar/ico"; AgentProperties props = Agent.Properties; // Set the ZIS Version to 1.5r1 props.ZisVersion = SifVersion.SIF15r1.ToString(); props.AgentIconUrl = iconURL; Agent.Name = "acmeAgent"; props.AgentVendor = "acmeVendor"; props.AgentVersion = "2.6.5.8"; props.ApplicationName = "acmeApp"; props.ApplicationVendor = "acme<>AppVendor"; props.ApplicationVersion = "10.2"; Zone.Connect(ProvisioningFlags.Register); InMemoryProtocolHandler handler = (InMemoryProtocolHandler)Zone.ProtocolHandler; SIF_Register sr = (SIF_Register)handler.readMsg(); Assert.AreEqual(SifVersion.SIF15r1, sr.SifVersion, "SifVersion"); Assert.AreEqual(SifVersion.SIF15r1.Xmlns, sr.GetXmlns(), "SifVersion->Xmlns"); Assert.AreEqual(Agent.Id, sr.SourceId, "SourceID"); Assert.AreEqual("acmeAgent", sr.SIF_Name, "Name"); Assert.IsNull(sr.SIF_NodeVendor, "Agent Vendor"); Assert.IsNull(sr.SIF_NodeVersion, "Agent Version"); SIF_Application appInfo = sr.SIF_Application; Assert.IsNull(appInfo); Assert.IsNull(sr.SIF_Icon, "Icon"); // Assert the versions in the message. If the ADK is initialized to // SIF 1.5r1, it should not be sending any versions that start with a // "2" SifVersion messageVersion = sr.SifVersion; Assert.AreEqual(SifVersion.SIF15r1, messageVersion, "Should be version 1.5r1"); foreach (SIF_Version version in sr.GetSIF_Versions()) { String versionString = version.TextValue; Assert.IsTrue(versionString.StartsWith("1"), "Should start with 1 but was " + versionString); } }
public void testRegisterOverrideZISVersion() { Adk.SifVersion = (SifVersion.SIF20); AgentProperties props = Agent.Properties; props.OverrideSifVersions = "1.1, 2.5"; Zone.Connect(ProvisioningFlags.Register); InMemoryProtocolHandler handler = (InMemoryProtocolHandler)Zone.ProtocolHandler; SIF_Register sr = (SIF_Register)handler.readMsg(); SIF_Version[] versions = sr.GetSIF_Versions(); Assert.IsNotNull(versions); Assert.AreEqual(2, versions.Length); Assert.AreEqual("1.1", versions[0].Value); Assert.AreEqual("2.5", versions[1].Value); }