Beispiel #1
0
        public void InstallLicense()
        {
            LicenseHeader header = new LicenseHeader()
            {
                InstallNumber = b1App.Company.InstallationId,
                SystemNumber  = b1App.Company.SystemId,
                Items         = new List <LicenseModule>()
                {
                    new LicenseModule()
                    {
                        Description = "I18NExample", Name = "I18NExample", ExpirationDate = DateTime.Today.AddDays(3)
                    },
                    new LicenseModule()
                    {
                        Description = "Foo", Name = "Foo", ExpirationDate = DateTime.Today.AddDays(3)
                    },
                },
                LicenseNamespace = "DOVER_WL"
            };
            LicenseService service     = new LicenseService();
            var            privateKey  = CreateKeys.CreateKeyPair();
            string         xmlLicense  = service.GenerateLicense(header, privateKey);
            string         licensePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "license.xml");

            File.WriteAllText(licensePath, xmlLicense);

            Form     licenseForm         = UIHelper.GetFormAfterAction("Dover.license", b1App, () => b1App.Menus.Item("doverLicense").Activate());
            EditText licensePathEditText = (EditText)licenseForm.Items.Item("moduleEd").Specific;

            licensePathEditText.Value = licensePath;
            licenseForm.Items.Item("importBt").Click();
            AssertNoFrameworkError();
            BusinessOneDAO b1DAO = app.Resolve <BusinessOneDAO>();

            Assert.AreEqual(b1DAO.ExecuteSqlForObject <int>("select count(*) from \"@DOVER_LICENSE\""), 1);
            Assert.AreEqual(b1DAO.ExecuteSqlForObject <string>("select \"U_namespace\" from \"@DOVER_LICENSE\""), "DOVER_WL");
        }