예제 #1
0
        public void InjectThrowsOnUnknownDependency()
        {
            var container = Container.Create();
            var resolver  = container.Install();

            var unknownClass = new UnknownClass();

            var exception = Assert.Throws <System.Collections.Generic.KeyNotFoundException>(() => resolver.Inject(unknownClass));
        }
예제 #2
0
        public void InjectFillsField()
        {
            var container = Container.Create();

            container.Bind <EmptyClass>().ToNew().AsCached().OnRequest();
            var resolver = container.Install();

            var unknownClass = new UnknownClass();

            resolver.Inject(unknownClass);

            Assert.True(unknownClass.Empty != null);
        }