PageRenderTime 223ms CodeModel.GetById 81ms app.highlight 5ms RepoModel.GetById 135ms app.codeStats 1ms

/src/UnitTests/IOC/FluentExtensionTests.cs

http://github.com/philiplaureano/LinFu
C# | 116 lines | 98 code | 18 blank | 0 comment | 0 complexity | 751222ff504a273ec366c559d5e3420f MD5 | raw file
  1using Xunit;
  2using SampleLibrary;
  3
  4namespace LinFu.UnitTests.IOC
  5{
  6    public partial class FluentExtensionTests
  7    {
  8        [Fact]
  9        public void ServiceContainerShouldSupportInjectingNamedOncePerRequestServices()
 10        {
 11            TestOncePerRequest("MyService", inject => inject.Using<SampleClass>());
 12        }
 13
 14        [Fact]
 15        public void ServiceContainerShouldSupportInjectingNamedOncePerThreadServicesUsingContainerLambdas()
 16        {
 17            TestOncePerThread("MyService", inject => inject.Using(container => new SampleClass()));
 18        }
 19
 20        [Fact]
 21        public void ServiceContainerShouldSupportInjectingNamedOncePerThreadServicesUsingLambdas()
 22        {
 23            TestOncePerThread("MyService", inject => inject.Using(() => new SampleClass()));
 24        }
 25
 26        [Fact]
 27        public void ServiceContainerShouldSupportInjectingNamedServicesOncePerThread()
 28        {
 29            TestOncePerThread("MyService", inject => inject.Using<SampleClass>());
 30        }
 31
 32        [Fact]
 33        public void ServiceContainerShouldSupportInjectingNamedSingletons()
 34        {
 35            TestSingleton("MyService", inject => inject.Using<SampleClass>());
 36        }
 37
 38        [Fact]
 39        public void ServiceContainerShouldSupportInjectingNamedSingletonsUsingContainerLambdas()
 40        {
 41            TestSingleton("MyService", inject => inject.Using(container => new SampleClass()));
 42        }
 43
 44        [Fact]
 45        public void ServiceContainerShouldSupportInjectingNamedSingletonsUsingLambdas()
 46        {
 47            TestSingleton("MyService", inject => inject.Using(() => new SampleClass()));
 48        }
 49
 50        [Fact]
 51        public void ServiceContainerShouldSupportInjectingOncePerRequestServicesUsingContainerLambdas()
 52        {
 53            TestOncePerRequest("MyService", inject => inject.Using(container => new SampleClass()));
 54        }
 55
 56        [Fact]
 57        public void ServiceContainerShouldSupportInjectingOncePerRequestServicesUsingLambdas()
 58        {
 59            TestOncePerRequest("MyService", inject => inject.Using(() => new SampleClass()));
 60        }
 61
 62        [Fact]
 63        public void ServiceContainerShouldSupportInjectingServicesOncePerRequest()
 64        {
 65            TestOncePerRequest(string.Empty, inject => inject.Using<SampleClass>());
 66        }
 67
 68        [Fact]
 69        public void ServiceContainerShouldSupportInjectingServicesOncePerRequestUsingContainerLambdas()
 70        {
 71            TestOncePerRequest(string.Empty, inject => inject.Using(container => new SampleClass()));
 72        }
 73
 74        [Fact]
 75        public void ServiceContainerShouldSupportInjectingServicesOncePerRequestUsingLambdas()
 76        {
 77            TestOncePerRequest(string.Empty, inject => inject.Using(() => new SampleClass()));
 78        }
 79
 80        [Fact]
 81        public void ServiceContainerShouldSupportInjectingServicesOncePerThread()
 82        {
 83            TestOncePerThread(string.Empty, inject => inject.Using<SampleClass>());
 84        }
 85
 86        [Fact]
 87        public void ServiceContainerShouldSupportInjectingServicesOncePerThreadUsingContainerLambdas()
 88        {
 89            TestOncePerThread(string.Empty, inject => inject.Using(container => new SampleClass()));
 90        }
 91
 92        [Fact]
 93        public void ServiceContainerShouldSupportInjectingServicesOncePerThreadUsingLambdas()
 94        {
 95            TestOncePerThread(string.Empty, inject => inject.Using(() => new SampleClass()));
 96        }
 97
 98        [Fact]
 99        public void ServiceContainerShouldSupportInjectingSingletons()
100        {
101            TestSingleton(string.Empty, inject => inject.Using<SampleClass>());
102        }
103
104        [Fact]
105        public void ServiceContainerShouldSupportInjectingSingletonsUsingContainerLambdas()
106        {
107            TestSingleton(string.Empty, inject => inject.Using(container => new SampleClass()));
108        }
109
110        [Fact]
111        public void ServiceContainerShouldSupportInjectingSingletonsUsingLambdas()
112        {
113            TestSingleton(string.Empty, inject => inject.Using(() => new SampleClass()));
114        }
115    }
116}