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);

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