Beispiel #1
0
        public static void Main(string[] args)
        {
            //var testArgs = new[] { "-i", @"D:\deploy\project", "-n", "TESTRUN2" };

            var options = new OptionsParser();
            var serviceData = options.Parse(args);
            if (serviceData == null)
                return;

            var client = new ClientFacade(
                ConfigurationManager.AppSettings["login"],
                ConfigurationManager.AppSettings["password"],
                serviceData);

            try {
                if (client.OpenSession()) {
                    Console.WriteLine("Connection to service is established. Connection session is opened.");

                    client.SendFiles();
                    client.Deploy();
                } else {
                    Console.WriteLine("Connection was terminated because folder '{0}' is already is use.", serviceData.Directory);

                    client.Close();
                    ClientFacade.NeedClose = true;
                }
            } catch (Exception ex) {
                HandleException(ex);
                client.Abort();
                ClientFacade.NeedClose = true;
            }

            while (ClientFacade.NeedClose != true) { Thread.Sleep(500); }

            Console.WriteLine("\r\nPress any key to close...");
            Console.ReadKey();
        }
Beispiel #2
0
        private static void ParseArgsAndCheckResultForNull(string[] args)
        {
            var options = new OptionsParser();
            var data = options.Parse(args);

            Assert.IsNull(data);
        }
Beispiel #3
0
        public void FilesShoudBeReadAndCompressedCorrectly(string[] args)
        {
            var options = new OptionsParser();
            var data = options.Parse(args);
            var surveyPackage = LoadSurveyToPackage(_surveyDir);

            Assert.NotNull(data);
            CollectionAssert.AreEqual(surveyPackage, data.Files);
        }
Beispiel #4
0
 public ServiceData ArgsShouldBeInterpretedCorrectly(string[] args)
 {
     var options = new OptionsParser();
     return options.Parse(args);
 }