Beispiel #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));
        }
Beispiel #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);
        }