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

Language C# Lines 45
MD5 Hash 83a5af40fe41eb2a799ab522b7aa6a15
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
34
35
36
37
38
39
40
41
42
43
44
45
using System;
using Moq;
using Ninject.Activation;
using Ninject.Activation.Blocks;
using Ninject.Syntax;
using Xunit;

namespace Ninject.Tests.Unit.ActivationBlockTests
{
	public class ActivationBlockContext
	{
		protected readonly ActivationBlock block;
		protected readonly Mock<IResolutionRoot> parentMock;
		protected readonly Mock<IRequest> requestMock;

		public ActivationBlockContext()
		{
			parentMock = new Mock<IResolutionRoot>();
			requestMock = new Mock<IRequest>();
			block = new ActivationBlock(parentMock.Object);
		}
	}

	public class WhenCanResolveIsCalled : ActivationBlockContext
	{
		[Fact]
		public void DelegatesCallToParent()
		{
			IRequest request = requestMock.Object;
			block.CanResolve(request);
			parentMock.Verify(x => x.CanResolve(request));
		}
	}

	public class WhenResolveIsCalledWithRequestObject : ActivationBlockContext
	{
		[Fact]
		public void DelegatesCallToParent()
		{
			IRequest request = requestMock.Object;
			block.Resolve(request);
			parentMock.Verify(x => x.Resolve(request));
		}
	}
}
Back to Top