示例#1
0
        public ActionResult ParameterInjection(string value, int id, IInvokerDependency resolved, NotRegistered notRegistered)
        {
            this.ViewData["Value"] = value;
            this.ViewData["Id"] = id;

            // IInvokerDependency should be resolved by the extensible action invoker.
            if (resolved == null)
            {
                this.ViewData["Resolved"] = "was not resolved but should have been";
            }
            else
            {
                this.ViewData["Resolved"] = "was resolved by the action invoker";
            }

            // The concrete/not registered dependency should pass through model binding
            // and not be resolved by the action invoker.
            if (notRegistered == null)
            {
                this.ViewData["NotRegistered"] = "was incorrectly resolved by the action invoker";
            }
            else
            {
                this.ViewData["NotRegistered"] = "was (correctly) left as null since it wasn't passed in and isn't registered with the container";
            }

            return View();
        }
示例#2
0
 public void WhenNotRegisteredMessageSent_ThenThrows()
 {
     Assert.Throws(Is.AssignableTo <Exception>(), () =>
     {
         var msg = new NotRegistered();
         _bus.Publish(ref msg);
     });
 }
示例#3
0
 public void WhenNotRegisteredMessageSent_ThenThrows()
 {
     Assert.Throws(Is.AssignableTo<Exception>(), () =>
     {
         var msg = new NotRegistered();
         _bus.Publish(ref msg);
     });
 }
        public NotRegisteredView(NotRegistered data)
        {
            if (data == null)
            {
                throw new ArgumentNullException(nameof(data));
            }

            Data = data;
        }
 public bool IsValid()
 {
     return(!NotRegistered.Any());
 }
示例#6
0
        public ActionResult ParameterInjection(string value, int id, IInvokerDependency resolved, NotRegistered notRegistered)
        {
            this.ViewData["Value"] = value;
            this.ViewData["Id"]    = id;

            // IInvokerDependency should be resolved by the extensible action invoker.
            if (resolved == null)
            {
                this.ViewData["Resolved"] = "was not resolved but should have been";
            }
            else
            {
                this.ViewData["Resolved"] = "was resolved by the action invoker";
            }

            // The concrete/not registered dependency should pass through model binding
            // and not be resolved by the action invoker.
            if (notRegistered == null)
            {
                this.ViewData["NotRegistered"] = "was incorrectly resolved by the action invoker";
            }
            else
            {
                this.ViewData["NotRegistered"] = "was (correctly) left as null since it wasn't passed in and isn't registered with the container";
            }

            return(View());
        }