コード例 #1
0
        public void TextSubstitutionHelperHandlesEmptyEntries()
        {
            var subs = new SettingsManager();
            subs.Add("Foo", "Bar");
            subs.Add("Frodo", null);

            var input = "Baggins";
            var output = TextSubstitutionHelper.Substitute(subs, input);

            Assert.AreEqual(input, output);
        }
コード例 #2
0
ファイル: User.cs プロジェクト: IntegerMan/Alfred
        /// <summary>
        ///     Initializes a new instance of the <see cref="User" /> class.
        /// </summary>
        /// <exception cref="ArgumentOutOfRangeException"> The name cannot be empty. </exception>
        /// <param name="name"> The identifier. </param>
        /// <param name="isSystemUser">
        ///     <see langword="true"/> if this instance is system user, <see langword="false"/> if not.
        /// </param>
        internal User([NotNull] string name, bool isSystemUser)
        {
            //- Validation
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentOutOfRangeException(nameof(name), Resources.UserCtorNullId);
            }

            Name = name;
            UniqueId = Guid.NewGuid();
            IsSystemUser = isSystemUser;

            // Set up the variables collection
            UserVariables = new SettingsManager();
            UserVariables.Add("topic", "*");
        }
コード例 #3
0
        public void TextSubstitutionHelperSubstitutesText()
        {
            var subs = new SettingsManager();
            subs.Add("Foo", "Bar");
            var output = TextSubstitutionHelper.Substitute(subs, "Foo");

            Assert.AreEqual("Bar", output);
        }