コード例 #1
0
 public void Cloneable()
 {
     var cmd = (CommandType) CommandType.DefInventoryCommand.Clone();
       cmd.OutputFileName = "";
       if (cmd.OutputFileName == CommandType.DefInventoryCommand.OutputFileName)
           throw new Exception();
       var tasks = new Task {Mailer = new List<MailerSubscriber> {new MailerSubscriber {CC = "CC"}}};
       var cfg = new Config {VMSConfigList = new List<VMSConfig> {new VMSConfig {Enabled = true, Task = tasks}}};
       var cfg2 = (Config) cfg.Clone();
       var vmsConfig2 = cfg2.VMSConfigList[0];
       var mailerSubscribers = vmsConfig2.Task.Mailer;
       mailerSubscribers[0].CC = "CC2";
       if (mailerSubscribers[0].CC == cfg.VMSConfigList[0].Task.Mailer[0].CC)
           throw new Exception();
 }
コード例 #2
0
ファイル: Config.cs プロジェクト: siarheimilkevich/VSSync
        private static void GenerateTestXml(string tasksConfigPath)
        {
            var contacts = new List<Contact>();
            var subscriber = new MailerSubscriber
                                 {
                                     IsCompleted = true,
                                     IsStarted = true,
                                     IsError = true,
                                     ErrorMessageTemplate = "User: {5}\r\n{0} - {2}\r\nThe task result is wrong. \r\n{3} ",
                                     CompleteMessageTemplate = "User: {5}\r\n{0} - {1} - {2} - \r\nThe task is completed. \r\n{3} ",
                                     To = @"[email protected],
            [email protected]",
                                 };

            var mailer = new List<MailerSubscriber>
                             {
                                 subscriber
                             };

            var task = new Task
                           {
                               Interval = 1,
                               StartDateTime = DateTime.Now.AddMinutes(1),
                               Mailer = mailer,
                               Commands = new List<CommandType>()
                                              {
                                                  CommandType.DefInventoryCommand.CopyTo(new CommandType()),
                                                  (CommandType) CommandType.DefProductsCommand.Clone()
                                              }
                           };
            var tc = new Config
                         {
                             Version = "1.0.10.1",
                             Login = "******",
                             Password = "******",
                             Contacts = contacts,
                             SmtpSettings = new List<SmtpSetting>
                                                {
                                                    new SmtpSetting
                                                        {
                                                            EnableEmailSSL = false,
                                                            From = "*****@*****.**",
                                                            Host = "smtp.mail.ru",
                                                            Port = 25,
                                                            Login = "******",
                                                            Password = "******"
                                                        },
                                                    new SmtpSetting
                                                        {
                                                            EnableEmailSSL = false,
                                                            From = "*****@*****.**",
                                                            Host = "ssbmsrv000.VendScreen.by",
                                                            Port = 25,
                                                            Login = "******"
                                                        }
                                                },
                             HoldFileHours = 150,
                             IsMei = false,
                             Mei = new Mei
                                       {
                                           EasitraxDatabase = "sx7://10.0.0.2/f:/shared databases",
                                           Login = "******",
                                           Password = "******",
                                           ExecutablePath = @"D:\Downloads\ProcessExplorer\Procexp.exe",
                                           OutputDirectory = @"D:\output",
                                           ConnectionCommandLineParam = "d 63 r VS0003 . 12",
                                           CommandLineParam1 = ""
                                       },
                             VendMax = new VendMax
                                           {
                                               Server = "SSBMSRV000",
                                               Database = "QA50333_qa",
                                               Login = "******",
                                               Password = "******",
                                               OutputDirectory = @"D:\output",
                                               IsIntegrated = false
                                           },
                             UseDefaultEmail = true,
                             WebService = new WebService()
                                              {
                                                  Login = "******",
                                                  Password = "******",
                                                  DoArchiving = false,
                                                  Url = "https://vsm2m.net/import/upload/automatic"
                                              },
                             VMSConfigList = new List<VMSConfig>
                                                 {
                                                     new VMSConfig {Enabled = true, Task = task},
                                                     new VMSConfig
                                                         {
                                                             Enabled = true,
                                                             Task =
                                                                 new Task
                                                                     {
                                                                         Interval = 15,
                                                                         Mailer = task.Mailer,
                                                                         StartDateTime = task.StartDateTime,
                                                                         StartDateTimeSpecified =
                                                                             task.StartDateTimeSpecified,
                                                                         Commands = new List<CommandType>()
                                                                                        {
                                                                                            (CommandType)
                                                                                            CommandType.
                                                                                                DefServiceCallsCommand.
                                                                                                Clone()
                                                                                            //Select * from ServiceCalls where status = 'P'
                                                                                        }
                                                                     }
                                                         },
                                                 }
                         };

            tc.Validate();
            tc.SaveToFile(tasksConfigPath);
        }