示例#1
0
        public void ThrowsIfServiceTypeIsNull()
        {
            MockServiceImpl impl = new MockServiceImpl();

            DependencyService.Register <MockServiceImpl>();
            Assert.Throws <ArgumentNullException>(() => DependencyService.Resolve(null));
        }
        public void PreferServiceTypeFromContainer()
        {
            MockServiceImpl impl = new MockServiceImpl();

            _container.Register(typeof(IMockService), impl);
            DependencyService.Register <IMockService, MockServiceImpl2>();
            var result = DependencyService.Resolve <IMockService>();

            Assert.That(result, Is.SameAs(impl));
        }