示例#1
0
        public void TestUpdater()
        {
            using (UpdateService <TestUpdateServer> service =
                       new UpdateService <TestUpdateServer>(51315, "Updater"))
            {
                service.Connect();

                using (UpdateClient <IUpdateServer> client =
                           new UpdateClient <IUpdateServer>(new IPAddress(new byte[] { 127, 0, 0, 1 }), 51315, "Updater"))
                {
                    client.Connect();

                    Assert.IsTrue(client.ServiceObject.CheckForUpdate(new Version(1, 0)), "Version check failed!");
                    Assert.IsFalse(client.ServiceObject.CheckForUpdate(new Version(2, 0)), "Version check not failed!");
                    Assert.IsFalse(client.ServiceObject.CheckForUpdate(new Version(3, 0)), "Version check not failed!");

                    using (IFileLoader loader = new StreamFileLoader(new MemoryStream()))
                    {
                        client.ServiceObject.DownloadUpdate(loader);
                    }

                    client.Disconnect();
                }

                service.Disconnect();
            }
        }
示例#2
0
        public void TestUpdater()
        {
            using (UpdateService<TestUpdateServer> service =
                new UpdateService<TestUpdateServer>(51315, "Updater"))
            {
                service.Connect();

                using (UpdateClient<IUpdateServer> client =
                    new UpdateClient<IUpdateServer>(new IPAddress(new byte[] { 127, 0, 0, 1 }), 51315, "Updater"))
                {
                    client.Connect();

                    Assert.IsTrue(client.ServiceObject.CheckForUpdate(new Version(1, 0)), "Version check failed!");
                    Assert.IsFalse(client.ServiceObject.CheckForUpdate(new Version(2, 0)), "Version check not failed!");
                    Assert.IsFalse(client.ServiceObject.CheckForUpdate(new Version(3, 0)), "Version check not failed!");

                    using (IFileLoader loader = new StreamFileLoader(new MemoryStream()))
                    {
                        client.ServiceObject.DownloadUpdate(loader);
                    }

                    client.Disconnect();
                }

                service.Disconnect();
            }
        }