Example #1
0
        public static IEnumerable <object[]> GetEqualsTestData()
        {
            var name  = "foo";
            var value = "bar";
            var p1    = ComponentParameter.CreateParameter(name, value);
            var p2    = ComponentParameter.CreateParameter(name, value);
            var p3    = ComponentParameter.CreateCascadingValue(name, value);
            var p4    = ComponentParameter.CreateParameter(string.Empty, value);
            var p5    = ComponentParameter.CreateParameter(name, string.Empty);

            yield return(new object[] { p1, p1, true });

            yield return(new object[] { p1, p2, true });

            yield return(new object[] { p3, p3, true });

            yield return(new object[] { p1, p3, false });

            yield return(new object[] { p1, p4, false });

            yield return(new object[] { p1, p5, false });
        }
Example #2
0
 public void Test001()
 {
     Should.Throw <ArgumentNullException>(() => ComponentParameter.CreateCascadingValue(null, null !));
     Should.Throw <ArgumentNullException>(() => { ComponentParameter p = (null, null, true); });
 }
 public static void SetCascadingValue <T>(this IRenderedComponentBase <T> self, string name, object value) where T : IComponent
 {
     self.SetParametersAndRender(ComponentParameter.CreateCascadingValue(name, value));
 }
        public static void SetCascadingValue <T>(this IRenderedComponentBase <T> self, Expression <Func <T, object> > exp, object value) where T : IComponent
        {
            var name = (exp.Body as MemberExpression ?? ((UnaryExpression)exp.Body).Operand as MemberExpression).Member.Name;

            self.SetParametersAndRender(ComponentParameter.CreateCascadingValue(name, value));
        }
Example #5
0
 public IComponentBuilder <TComponent> CascadingValue(object value)
 {
     _componentParameters.Add(ComponentParameter.CreateCascadingValue(null, value));
     return(this);
 }
Example #6
0
 /// <summary>
 /// Creates a cascading value which can be passed to a test contexts render methods.
 /// </summary>
 /// <param name="value">Value of the parameter</param>
 /// <returns>The <see cref="ComponentParameter"/>.</returns>
 public static ComponentParameter CascadingValue(object value)
 => ComponentParameter.CreateCascadingValue(null, value);
Example #7
0
 /// <summary>
 /// Creates a cascading value which can be passed to a test contexts render methods.
 /// </summary>
 /// <param name="name">Parameter name</param>
 /// <param name="value">Value of the parameter</param>
 /// <returns>The <see cref="ComponentParameter"/>.</returns>
 public static ComponentParameter CascadingValue(string name, object value)
 => ComponentParameter.CreateCascadingValue(name, value);