Пример #1
0
 public void TestHelpTopicsAssigned()
 {
     foreach (HelpTopic topic in Enum.GetValues(typeof(HelpTopic)))
     {
         Assert.IsFalse(string.IsNullOrEmpty(StringValueAttribute.GetValue(topic)), $"Topic {topic} does not have a html reference attached");
     }
 }
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            string stringValue     = StringValueAttribute.GetValue(value);
            string translatedValue = Translation.GetTranslation(stringValue);

            return(translatedValue);
        }
        public void LicenseStatus_ReturnsStatusFromEdition()
        {
            var viewModel = BuildViewModel();

            _activationHelper.LicenseStatus.Returns(LicenseStatus.Blocked);

            Assert.AreEqual(LicenseStatus.Blocked, viewModel.LicenseStatus);
            Assert.AreEqual(StringValueAttribute.GetValue(LicenseStatus.Blocked), viewModel.LicenseStatusText);
        }
Пример #4
0
        private void TestSingleHelpFile(string filename, string folder)
        {
            var helpPath = folder;

            foreach (HelpTopic topic in Enum.GetValues(typeof(HelpTopic)))
            {
                var sourceFile = StringValueAttribute.GetValue(topic);
                sourceFile = Path.Combine(helpPath, sourceFile + ".html");
                Assert.IsTrue(File.Exists(sourceFile), $"Help file '{sourceFile}' does not exist in {filename}!");
            }
        }
Пример #5
0
        public void AllErrorCodes_ArePresentInTranslation(ErrorCode errorCode)
        {
            // Store the english translator for other tests...
            if (_englishTranslator == null)
            {
                _englishTranslator = new BasicTranslator(Path.Combine(_translationTestHelper.FindTranslationFolder(), "english.ini"));
            }

            var section = "ErrorCodes";

            int exitCode     = (int)errorCode;
            var defaultValue = StringValueAttribute.GetValue(errorCode);

            Assert.AreEqual(defaultValue, _englishTranslator.GetTranslation(section, exitCode.ToString()), $"The value for {errorCode} ({exitCode}) is not set!\r\nAdd:\r\n{exitCode}={defaultValue}");
        }
Пример #6
0
        private void TestSingleHelpFile(string filename, string folder, ManualPath filter)
        {
            var helpPath = folder;

            foreach (HelpTopic topic in Enum.GetValues(typeof(HelpTopic)))
            {
                var sourceFile = StringValueAttribute.GetValue(topic);
                if (filter == ManualPath.PdfCreatorManual && sourceFile.Contains("server"))
                {
                    continue;
                }

                sourceFile = Path.Combine(helpPath, sourceFile + ".html");
                Assert.IsTrue(File.Exists(sourceFile), $"Help file '{sourceFile}' does not exist in {filename}!");
            }
        }
        public string GetErrorText(ErrorCode errorCode, bool withNumber)
        {
            var errorNumber = (int)errorCode;

            var errorCodeSection = errorNumber.ToString();
            var errorMessage     = _translator.GetTranslation("ErrorCodes", errorCodeSection);

            if (string.IsNullOrWhiteSpace(errorMessage))
            {
                errorMessage = StringValueAttribute.GetValue(errorCode);
            }

            if (string.IsNullOrWhiteSpace(errorMessage))
            {
                errorMessage = _translator.GetTranslation("ErrorCodes", "Default");
            }

            if (withNumber)
            {
                return(errorNumber + " - " + errorMessage);
            }

            return(errorMessage);
        }
Пример #8
0
 /// <summary>
 ///     Determine the string value of a help topic, which identifies the section within the user guide.
 /// </summary>
 /// <param name="value">An enum value that is the symbolic reference to a help topic.</param>
 /// <returns>The string representation of the help topic, i.e. the path within the file.</returns>
 private string GetTopic(object value)
 {
     return(StringValueAttribute.GetValue(value));
 }
        private ITranslator BuildTranslator()
        {
            var translationData = Data.CreateDataStorage();

            translationData.SetValue(@"LicenseTab\LicenseExpiresNever", "Never");
            translationData.SetValue(@"LicenseTab\ActivationSuccessful", ActivationSuccessfulString);
            translationData.SetValue(@"LicenseTab\ActivationSuccessfulMessage", ActivationSuccessfulMessageString);
            translationData.SetValue(@"LicenseTab\ActivationFailed", ActivationFailedString);
            translationData.SetValue(@"LicenseTab\ActivationFailedMessage", ActivationFailedMessageString);

            foreach (var licenseStatus in Enum.GetValues(typeof(LicenseStatus)))
            {
                translationData.SetValue(@"LicenseTab\LicenseStatus." + licenseStatus, StringValueAttribute.GetValue(licenseStatus));
            }

            // TODO SectionNameTranslator
            return(new BasicTranslator("None", translationData));
        }