示例#1
0
        public void GetService_ServiceTypeIsNull_ThrowsArgumentNullException()
        {
            // arrange
            using var container = new Container();
            var target = new SimpleInjectorServiceProviderAdapter(container);

            // act, assert
            Assert.Throws <ArgumentNullException>(() => target.GetService(null !));
        }
示例#2
0
        public void GetService_ServiceTypeIsNotNull_ResolvesAndReturnsInstanceFromContainer()
        {
            // arrange
            using var container = new Container();
            container.Register <SomeService>();
            container.Register <SimpleInjectorServiceProviderAdapterTests>();

            var target = new SimpleInjectorServiceProviderAdapter(container);

            // act
            var actual = target.GetService(typeof(SomeService));

            // assert
            Assert.Equal(typeof(SomeService), actual.GetType());
        }