コード例 #1
0
        public void Instantiation ()
        {
            Properties root = new Properties();
            root.Add ("foo", "this");
            root.Add ("bar", "is");
            Properties props = new Properties(root);
			props.SetProperty("myPropertyKey", "myPropertyValue");
            Assert.AreEqual (3, props.Count);
            Assert.AreEqual ("this", props.GetProperty ("foo"));
            Assert.AreEqual ("is", props.GetProperty ("bar"));
            Assert.AreEqual ("myPropertyValue", props.GetProperty ("myPropertyKey"));
        }
 public void FromMessageWithPropertiesMethodAndPropertiesPayload()
 {
     MethodInfo method = typeof (TestService).GetMethod("PropertiesPayload");
     MethodParameterMessageMapper mapper = new MethodParameterMessageMapper(method);
     Properties payload = new Properties();
     payload.SetProperty("prop1", "foo");
     payload.SetProperty("prop2", "bar");
     IMessage message =
         MessageBuilder.WithPayload(payload).SetHeader("prop1", "not").SetHeader("prop2", "these").Build();
     object[] args = (object[]) mapper.FromMessage(message);
     Properties result = (Properties) args[0];
     Assert.That(result.Count, Is.EqualTo(2));
     Assert.That(result.GetProperty("prop1"), Is.EqualTo("foo"));
     Assert.That(result.GetProperty("prop2"), Is.EqualTo("bar"));
 }