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

Language C# Lines 35
MD5 Hash aa20a091a37b0eb33fa5e47154855688
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
using System;
using Moq;
using Ninject.Activation;
using Ninject.Activation.Providers;
using Ninject.Tests.Fakes;
using Xunit;
using Xunit.Should;

namespace Ninject.Tests.Unit.CallbackProviderTests
{
	public class CallbackProviderContext
	{
		protected CallbackProvider<Sword> provider;
		protected readonly Mock<IContext> contextMock;

		public CallbackProviderContext()
		{
			contextMock = new Mock<IContext>();
		}
	}

	public class WhenCreateIsCalled : CallbackProviderContext
	{
		[Fact]
		public void ProviderInvokesCallbackToRetrieveValue()
		{
			var sword = new Sword();
			provider = new CallbackProvider<Sword>(c => sword);

			var result = provider.Create(contextMock.Object);

			result.ShouldBeSameAs(sword);
		}
	}
}
Back to Top