public void Resolve_WithAbritraryParameters_ReturnsResultCorrectly()
        {
            Func<ISymbol, Maybe<object>> strategy = _ => "Baz".ToMaybe<object>();

            var resolver = new DependencyResolver(strategy);
            var result = resolver.Resolve(typeof (IDisposable), "Foo");

            Assert.AreEqual("Baz", result);
        }
        public void Resolve_WithAbritraryParameters_CallsResolutionStrategyCorrectly()
        {
            string name = null;
            Type dependencyType = null;

            Func<ISymbol, Maybe<object>> strategy = symbol =>
                                                {
                                                    name = ((IDependencySymbol) symbol).Name;
                                                    dependencyType = ((IDependencySymbol) symbol).DependencyType;
                                                    return Maybe<object>.NoValue;
                                                };

            var resolver = new DependencyResolver(strategy);
            resolver.Resolve(typeof(IDisposable), "Foo");

            Assert.AreEqual("Foo", name);
            Assert.AreEqual(typeof(IDisposable), dependencyType);

        }
示例#3
0
 public static object Resolve(ISymbol symbol)
 {
     return(DependencyResolver.Resolve(symbol));
 }
示例#4
0
 public static object Resolve(Type dependencyType, string name)
 {
     return(DependencyResolver.Resolve(dependencyType, name));
 }
示例#5
0
 public static T Resolve <T>(ISymbol <T> symbol)
 {
     return(DependencyResolver.Resolve(symbol));
 }
示例#6
0
 public static T Resolve <T>(string name)
 {
     return(DependencyResolver.Resolve <T>(name));
 }
示例#7
0
 public static T Resolve <T>()
 {
     return(DependencyResolver.Resolve <T>());
 }