当前位置: 首页>>代码示例>>C#>>正文


C# PropertyBag.Add方法代码示例

本文整理汇总了C#中PropertyBag.Add方法的典型用法代码示例。如果您正苦于以下问题:C# PropertyBag.Add方法的具体用法?C# PropertyBag.Add怎么用?C# PropertyBag.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PropertyBag的用法示例。


在下文中一共展示了PropertyBag.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: test_money_with_currency

        public void test_money_with_currency()
        {
            PropertyBag bag = new PropertyBag();
            bag.Add("Money.Symbol", "$");
            bag.Add("Money.Currency", "AUD");

            string s = new MoneyWithCurrencyFilter().Run(1.7568, null, bag, null) as string;
            Assert.AreEqual("$1.76 AUD", s);
        }
开发者ID:codesoda,项目名称:Impression,代码行数:9,代码来源:MoneyTests.cs

示例2: DummyTemplateTest_HtmlCheckedFormatter

        public void DummyTemplateTest_HtmlCheckedFormatter()
        {
            PropertyBag bag = new PropertyBag();
            bag.Add("TrueValue", true);
            bag.Add("FalseValue", false);

            ImpressionEngine ie = ImpressionEngine.Create(bag);

            Assert.AreEqual("checked=\"checked\"", ie.RunString("{{ TrueValue | html_checked }}"));
            Assert.AreEqual("", ie.RunString("{{ FalseValue | html_checked }}"));
        }
开发者ID:codesoda,项目名称:Impression,代码行数:11,代码来源:ImpressionTests.cs

示例3: TestIIFWithBag

        public void TestIIFWithBag()
        {
            PropertyBag bag = new PropertyBag();
            bag.Add("Val1", 1);
            bag.Add("Val2", 2);

            object result = new IFFilter().Run(true, new[] { "Val1", "Val2" }, bag, null);
            Assert.AreEqual(result, 1);

            result = new IFFilter().Run(false, new[] { "Val1", "Val2" }, bag, null);
            Assert.AreEqual(result, 2);
        }
开发者ID:codesoda,项目名称:Impression,代码行数:12,代码来源:IFTests.cs

示例4: Copy

        public void Copy()
        {
            PropertyBag original = new PropertyBag();
            original.Add("abc", "123");
            original.Add("abc", "456");
            original.Add("def", "");

            PropertyBag copy = original.Copy();

            Assert.AreNotSame(original, copy);
            AssertAreEqual(original, copy);
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:12,代码来源:PropertyBagTest.cs

示例5: LoadMeUp1

 private void LoadMeUp1()
 {
     PropertyBag bag = new PropertyBag();
     bag.Add("One", 1);
     bag.Add("Two", 2);
     bag.Add("Three", 3);
     bag.Add("Four", 4);
     bag.Add("Five", 5);
     string currentFolder = Path.GetDirectoryName(Environment.CurrentDirectory);
     string templatePath = Path.Combine(currentFolder, "../templates/SimpleIfElseIfElseEndIf.htm");
     ImpressionEngine.Create(bag).Run(templatePath);
     count--;
 }
开发者ID:codesoda,项目名称:Impression,代码行数:13,代码来源:LoadTest.cs

示例6: PropertyBagTwoWayObjectSerializationTest

        public void PropertyBagTwoWayObjectSerializationTest()
        {
            var bag = new PropertyBag();

            bag.Add("key", "Value");
            bag.Add("Key2", 100.10M);
            bag.Add("Key3", Guid.NewGuid());
            bag.Add("Key4", DateTime.Now);
            bag.Add("Key5", true);
            bag.Add("Key7", new byte[3] { 42, 45, 66 } );
            bag.Add("Key8", null);
            bag.Add("Key9", new ComplexObject() { Name = "Rick",
            Entered = DateTime.Now,
            Count = 10 });

            string xml = bag.ToXml();

            TestContext.WriteLine(bag.ToXml());

            bag.Clear();

            bag.FromXml(xml);

            Assert.IsTrue(bag["key"] as string == "Value");
            Assert.IsInstanceOfType( bag["Key3"], typeof(Guid));
            Assert.IsNull(bag["Key8"]);
            //Assert.IsNull(bag["Key10"]);

            Assert.IsInstanceOfType(bag["Key9"], typeof(ComplexObject));
        }
开发者ID:CocoaLab,项目名称:WestwindToolkit,代码行数:30,代码来源:PropertyBagTest.cs

示例7: Accept

 public void Accept()
 {
     var updated = new PropertyBag(Get());
     Admixture.ForEach(kvp => updated.Add(kvp.Key, kvp.Value));
     Changes.ForEach(kvp => updated[kvp.Key] = kvp.Value);
     Leakage.ForEach(kvp => updated.Remove(kvp.Key));
     Set(updated);
 }
开发者ID:xeno-by,项目名称:elf4b,代码行数:8,代码来源:ChangeSet.cs

示例8: CanParseVarTags

 public void CanParseVarTags()
 {
     IPropertyBag bag = new PropertyBag();
     bag.Add("list", new [] { "Tom", "Dick", "Harry"});
     ImpressionEngine ie = ImpressionEngine.Create(bag);
     var result = ie.RunString("<!-- #VAR {{ list2 = list }} -->{{list2}}");
     Assert.AreEqual(bag["list"].GetType().ToString(), result);
 }
开发者ID:codesoda,项目名称:Impression,代码行数:8,代码来源:VarTagTests.cs

示例9: DummyTemplateTest_DefaultFormatter

        public void DummyTemplateTest_DefaultFormatter()
        {
            PropertyBag bag = new PropertyBag();
            bag.Add("DefaultValue", 1234);

            ImpressionEngine ie = ImpressionEngine.Create(bag);
            string result = ie.RunString("{{ InvalidField | default(DefaultValue) }}");
            Assert.IsNotNull(result);
            Assert.AreEqual("1234", result);
        }
开发者ID:codesoda,项目名称:Impression,代码行数:10,代码来源:ImpressionTests.cs

示例10: SerializeToXml

        public void SerializeToXml(string expectedXml, string[] keyValuePairs)
        {
            PropertyBag map = new PropertyBag();
            for (int i = 0; i < keyValuePairs.Length; i += 2)
                map.Add(keyValuePairs[i], keyValuePairs[i + 1]);

            StringWriter writer = new StringWriter();
            serializer.Serialize(writer, map);

            Assert.AreEqual(expectedXml, writer.ToString());
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:11,代码来源:PropertyBagTest.cs

示例11: GetQueryParameters

 public PropertyBag GetQueryParameters()
 {
     var retval = new PropertyBag();
     if (QueryParameters != null)
     {
         foreach (var queryParameter in QueryParameters)
         {
             retval.Add(queryParameter.Key, queryParameter.Value);
         }
     }
     return retval;
 }
开发者ID:rbramwell,项目名称:OrionSDK,代码行数:12,代码来源:ProfileItem.cs

示例12: IsMatchCombinations

        public void IsMatchCombinations(bool expectedMatch, string[] values)
        {
            PropertyBag metadata = new PropertyBag();
            foreach (string value in values)
                metadata.Add("key", value);

            ITestDescriptor component = Mocks.StrictMock<ITestDescriptor>();
            SetupResult.For(component.Metadata).Return(metadata);
            Mocks.ReplayAll();

            Assert.AreEqual(expectedMatch, new MetadataFilter<ITestDescriptor>("key",
                new EqualityFilter<string>("expectedValue")).IsMatch(component));
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:13,代码来源:MetadataFilterTest.cs

示例13: AddElement

        protected void AddElement(Profiles.OrderRelationElement element, PropertyBag bag)
        {
            const string category = "Provision¶©¹º";

            string desc = String.Format("ID := {{{0}}}", element.GetAttribute("Code"));
            PropertySpec item = new PropertySpec(element.GetAttribute("Name"), 0, category, desc);

            item.Key = element.GetAttribute("Code");
            #if false
            item.Attributes = new Attribute[] { ReadOnlyAttribute.Yes };
            #endif

            bag.Add(item);
        }
开发者ID:shilinxu,项目名称:honglt-myproject,代码行数:14,代码来源:frmProvision.cs

示例14: Subscription

        public Subscription(InfoServiceProxy swis, string endpointAddress, string query, string binding = "NetTcp", string dataFormat = "Xml", CredentialType credentialType = CredentialType.Certificate, string username = null, string password = null)
        {
            this.swis = swis;

            PropertyBag propertyBag = new PropertyBag
                {
                    {"Query", query}, 
                    {"EndpointAddress", endpointAddress}, 
                    {"Description", "SWQL Studio"}, 
                    {"DataFormat", dataFormat}, 
                    {"CredentialType", credentialType.ToString()}
                };

            if (!string.IsNullOrEmpty(binding))
                propertyBag["Binding"] = binding;

            if (credentialType == CredentialType.Username)
            {
                propertyBag.Add("Username", username);
                propertyBag.Add("Password", password);
            }

            SubscriptionUri = swis.Create(systemSubscription, propertyBag);
        }
开发者ID:rbramwell,项目名称:OrionSDK,代码行数:24,代码来源:Subscription.cs

示例15: TestHtmlSelectOptions

        public void TestHtmlSelectOptions()
        {
            PropertyBag bag = new PropertyBag();
            bag.Add("SelectedValue", "Value2");

            SelectListItem[] items = new[] {
                new SelectListItem { Text = "11", Value = "Value1"},
                new SelectListItem { Text = "6", Value = "6"},
                new SelectListItem { Text = "12", Value = "Value3"}
            };

            string optionHtml = new HtmlOptionsFilter().Run(items, new[] { "Text", "Value", "SelectedValue.Length" }, bag, null) as string;

            int i = 0;
        }
开发者ID:codesoda,项目名称:Impression,代码行数:15,代码来源:HtmlFilters.cs


注:本文中的PropertyBag.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。