Ejemplo n.º 1
0
        public void TestEnablingCheckOnProject()
        {
            var confiuration = new CheckConfiguration();
            var enlistment   = new Office14Enlistment();
            var asimo        = new DatabaseAsimo(enlistment);

            asimo.CheckFolderPath = Path.Combine(enlistment.CerberusHomeDir, "Checks");
            TestContext.WriteLine("Populating database with information from the current enlistment.");
            asimo.UpdateDatabaseWithEnlistmentContent(confiuration);
            Assert.AreNotEqual(0, confiuration.GetAllChecks());
            foreach (var check in confiuration.GetAllChecks())
            {
                TestContext.WriteLine(check);
            }
            const string checkToRun = "BrandingCheck";

            confiuration.EnableCheckForProject(checkToRun, "access");
            Assert.AreEqual(1, confiuration.ProjectChecks.Count);

            var unfilteredFiles = enlistment.GetFiles("intl", LcxType.Lcl);

            TestContext.WriteLine("Total items: {0}", unfilteredFiles.Count());

            //Split executions per language per locgroup to allow finite time of execution
            var distinctLanguages = asimo.GetDistinctLanguages(unfilteredFiles);
            var distinctProjects  = asimo.GetDistinctProjects(unfilteredFiles);

            TestContext.WriteLine("Distinct languages: {0}; {1}", distinctLanguages.Count(), string.Join(", ", distinctLanguages.ToArray()));
            TestContext.WriteLine("Distinct projects: {0}; {1}", distinctProjects.Count(), string.Join(", ", distinctProjects.ToArray()));

            var enabledChecks = confiuration.GetEnabledChecks("pl-pl", "word");

            TestContext.WriteLine("Enabled checks: {0}", string.Join(", ", enabledChecks.ToArray()));
            Assert.AreEqual(0, enabledChecks.Count());

            enabledChecks = confiuration.GetEnabledChecks("pl-pl", "access");
            TestContext.WriteLine("Enabled checks: {0}", string.Join(", ", enabledChecks.ToArray()));
            Assert.AreEqual(1, enabledChecks.Count());

            var availableChecks = new List <string> {
                checkToRun, "Not enabled check"
            };

            TestContext.WriteLine("Physically available checks: {0}", string.Join(", ", availableChecks.ToArray()));

            var availableEnabledCheck = availableChecks.Intersect(enabledChecks);

            Assert.AreEqual(1, availableEnabledCheck.Count());
            TestContext.WriteLine("Available enabled check: {0}", string.Join(", ", availableEnabledCheck.ToArray()));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes variables of Configurator program instance on program startup.
 /// </summary>
 private void Initialize()
 {
     ThisAssembly = Assembly.GetExecutingAssembly();
     ExeID        = string.Format(CultureInfo.InvariantCulture, "{0}, Version={1}", ThisAssembly.GetName().Name, ThisAssembly.GetName().Version);
     ExeName      = ThisAssembly.ManifestModule.Name;
     ExeDir       = Path.GetDirectoryName(ThisAssembly.Location);
     _enlistment  = new Office14Enlistment();
     _asimo       = new DatabaseAsimo(_enlistment);
     if (_enlistment.IsDetected)
     {
         _asimo.CheckFolderPath = Path.Combine(_enlistment.CerberusHomeDir, "Checks");
     }
     Database = new CheckConfiguration();
     _uiTheme = new StandardTheme();
 }