public void TryResolve_WithNoBindings_ReturnsNoValue()
        {
            var symbol = new Symbol();
            var source = new ExodataBindingModule();

            var resolver = new ExodataResolver(new[] { source });

            Maybe <int> value = resolver.TryResolve(ExodataRequest.Create <int, object, object>(symbol, Maybe <object> .NoValue, Maybe <object> .NoValue, null));

            Assert.AreEqual(Maybe <int> .NoValue, value);
        }
        public void TryResolve_WithNonAmbiguousBindingSelection_YieldsValue()
        {
            var symbol = new Symbol();
            var source = new ExodataBindingModule();

            source.Bind(symbol, 42);

            var resolver = new ExodataResolver(new[] { source });

            Maybe <int> result = resolver.TryResolve(ExodataRequest.Create <int, object, object>(symbol, Maybe <object> .NoValue, Maybe <object> .NoValue, null));

            Assert.AreEqual(42, result.Value);
        }
        public void TryResolve_WithAmbiguousBindingSelection_ThrowsAmbiguousExodataBindingsException()
        {
            var symbol = new Symbol();
            var source = new ExodataBindingModule();

            source.Bind(symbol, 42);
            source.Bind(symbol, 42);

            var resolver = new ExodataResolver(new[] { source });

            Maybe <int> result = resolver.TryResolve(ExodataRequest.Create <int, object, object>(symbol, Maybe <object> .NoValue, Maybe <object> .NoValue, null));

            var exception = Assert.Throws <AmbiguousExodataBindingsException>(() => { var x = result.HasValue; });

            Assert.IsNotNull(exception);
            Assert.AreEqual(2, exception.Bindings.Count());
        }