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

Language C# Lines 35
MD5 Hash b0c9617a6a2204dc234e1b9c79b4063b
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.ConstantProviderTests
{
	public class ConstantProviderContext
	{
		protected ConstantProvider<Sword> provider;
		protected readonly Mock<IContext> contextMock;

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

	public class WhenCreateIsCalled : ConstantProviderContext
	{
		[Fact]
		public void ProviderReturnsConstantValue()
		{
			var sword = new Sword();
			provider = new ConstantProvider<Sword>(sword);

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

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