ninject /src/Ninject.Tests/Unit/PropertyInjectionDirectiveTests.cs

Language C# Lines 33
MD5 Hash 3d93ce79f6b0b94c992f52c016b23c20
Repository https://github.com/developingchris/ninject.git View Raw File View Project SPDX
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System;
using Ninject.Injection;
using Ninject.Planning.Directives;
using Xunit;
using Xunit.Should;

namespace Ninject.Tests.Unit.PropertyInjectionDirectiveTests
{
	public class PropertyInjectionDirectiveContext
	{
		protected PropertyInjectionDirective directive;
	}

	public class WhenDirectiveIsCreated : PropertyInjectionDirectiveContext
	{
		[Fact]
		public void CreatesTargetForProperty()
		{
			var method = typeof(Dummy).GetProperty("Foo");
			PropertyInjector injector = delegate { };

			directive = new PropertyInjectionDirective(method, injector);

			directive.Target.Name.ShouldBe("Foo");
			directive.Target.Type.ShouldBe(typeof(int));
		}
	}

	public class Dummy
	{
		public int Foo { get; set; }
	}
}
Back to Top