示例#1
0
        public void Search()
        {
            var client  = new WindowsUpdateClient(UpdateServer.Default);
            var results = client.Search("IsInstalled=1");

            Assert.IsNotNull(results);
            Assert.IsNotNull(results.Updates);
            Assert.IsTrue(ToArray(results.Updates).Any());
        }
示例#2
0
        public void GetAllUpdates()
        {
            const string Criteria = "IsHidden=0 AND DeploymentAction=*";

            var client  = new WindowsUpdateClient(UpdateServer.WindowsUpdate);
            var results = client.Search(Criteria);

            Assert.IsNotNull(results);
            Assert.IsNotNull(results.Updates);
            Assert.IsTrue(ToArray(results.Updates).Any());
        }
示例#3
0
        public void Download()
        {
            var client  = new WindowsUpdateClient(UpdateServer.WindowsUpdate);
            var results = client.Search();

            Assert.IsNotNull(results);
            Assert.IsNotNull(results.Updates);
            Assert.IsTrue(ToArray(results.Updates).Any());

            var downloadResult = client.Download(results.Updates);

            Assert.AreEqual((int)Client.OperationResultCode.Succeeded, (int)downloadResult.ResultCode);
        }