示例#1
0
		public void By_default_any_type_as_key_is_supported()
		{
			var arguments = new Arguments(new CustomStringComparer());
			var key = new object();
			var value = "foo";

			arguments.Add(key, value);

			Assert.AreEqual("foo", arguments[key]);
		}
示例#2
0
		public void Custom_stores_get_picked_over_default_ones()
		{
			var arguments = new Arguments(new CustomStringComparer());
			var key = "foo";
			var value = new object();

			arguments.Add(key, value);

			Assert.AreEqual(value, arguments["boo!"]);
		}
示例#3
0
		public void ShouldBeAbleToSupplyValueForNullableParam()
		{
			var container = new WindsorContainer();
			container.Register(Component.For<ClassTakingNullable>());

			var arguments = new Arguments().Insert("SomeVal", 5);
			var s = container.Resolve<ClassTakingNullable>(arguments);

			Assert.IsNotNull(s.SomeVal);
		}
示例#4
0
		public void Handles_string_as_key_case_insensitive()
		{
			var arguments = new Arguments();
			var key = "foo";
			var value = new object();

			arguments.Add(key, value);

			Assert.IsTrue(arguments.Contains(key.ToLower()));
			Assert.IsTrue(arguments.Contains(key.ToUpper()));
		}
示例#5
0
		public void Handles_string_as_key()
		{
			var arguments = new Arguments();
			var key = "Foo";
			var value = new object();

			arguments.Add(key, value);

			Assert.AreEqual(1, arguments.Count);
			Assert.IsTrue(arguments.Contains(key));
			Assert.AreSame(value, arguments[key]);
		}