Esempio n. 1
0
        public void TestCreate()
        {
            VstsAgent agent1 = new VstsAgent
            {
                Enabled            = true,
                Id                 = 8474,
                Name               = "iotedge-win-99",
                Status             = VstsAgentStatus.Online,
                SystemCapabilities = new Dictionary <string, string>
                {
                    { "SysCap1Key", "SysCap1Value" },
                    { "SysCap2Key", "SysCap2Value" }
                },
                UserCapabilities = new Dictionary <string, string>
                {
                    { "UserCap1Key", "UserCap1Value" },
                    { "UserCap2Key", "UserCap2Value" }
                },
                Version = "version99"
            };

            IoTEdgeAgent agent2 = IoTEdgeAgent.Create(agent1);

            Assert.True(agent2.Enabled);
            Assert.AreEqual(8474, agent2.Id);
            Assert.AreEqual("iotedge-win-99", agent2.Name);
            Assert.AreEqual(VstsAgentStatus.Online, agent2.Status);
            Assert.AreEqual(2, agent2.SystemCapabilities.Count);
            Assert.True(agent2.SystemCapabilities.Contains(new AgentCapability("SysCap1Key", "SysCap1Value")));
            Assert.True(agent2.SystemCapabilities.Contains(new AgentCapability("SysCap2Key", "SysCap2Value")));
            Assert.AreEqual(2, agent2.UserCapabilities.Count);
            Assert.True(agent2.UserCapabilities.Contains(new AgentCapability("UserCap1Key", "UserCap1Value")));
            Assert.True(agent2.UserCapabilities.Contains(new AgentCapability("UserCap2Key", "UserCap2Value")));
            Assert.AreEqual("version99", agent2.Version);
        }
Esempio n. 2
0
 public void TestCreateWithNullValue()
 {
     Assert.That(() => IoTEdgeAgent.Create(null), Throws.TypeOf <ArgumentNullException>());
 }