Exemple #1
0
 private Valuer Values(params object[] Values)
 {
     values = new Valuer(Maker, db, Queryfy(
                             string.Join(", ", Values.Select((v, i) => "$" + i)),
                             Values));
     return(values);
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            string pid = Request.QueryString["pid"];
            string wid = Request.QueryString["wid"];

            if (!IsPostBack)
            {
                if (!string.IsNullOrEmpty(pid))
                {
                    LoadAccount(pid);
                    if (!string.IsNullOrEmpty(wid))
                    {
                        before.Visible = false;
                        Valuer v = new Valuer();
                        v.LoadPageObjects(this.Page, pid, "kneeosteoarthritisPain", wid);
                    }
                    else//new
                    {
                        after.Visible = false;
                        Valuer v = new Valuer();
                        v.EnablePageObjects(this.Page);
                    }
                }
                else
                {
                    Response.Redirect("~/default.aspx");
                }
            }
        }
Exemple #3
0
 /// <summary>Verifies two objects are equal by value.</summary>
 /// <param name="expected">Object to compare against.</param>
 /// <param name="details">Optional failure details.</param>
 /// <returns>Chainer to make additional assertions with.</returns>
 /// <exception cref="AssertException">If the expected behavior doesn't happen.</exception>
 public virtual AssertChainer <T> ValuesEqual(object expected, string details = null)
 {
     Difference[] differences = Valuer.Compare(expected, Actual).ToArray();
     if (differences.Length > 0)
     {
         throw new AssertException($"Value equality failed for type '{GetTypeName(expected)}'.",
                                   details, Gen.InitialSeed, string.Join <Difference>(Environment.NewLine, differences));
     }
     return(ToChainer());
 }
Exemple #4
0
 /// <summary>Verifies two objects are unequal by value.</summary>
 /// <param name="expected">Object to compare against.</param>
 /// <param name="details">Optional failure details.</param>
 /// <returns>Chainer to make additional assertions with.</returns>
 /// <exception cref="AssertException">If the expected behavior doesn't happen.</exception>
 public virtual AssertChainer <T> ValuesNotEqual(object expected, string details = null)
 {
     if (!Valuer.Compare(expected, Actual).Any())
     {
         throw new AssertException(
                   $"Value inequality failed for type '{GetTypeName(expected)}'.",
                   details, Gen.InitialSeed, expected?.ToString());
     }
     return(ToChainer());
 }
        protected void btnEdit_Click(object sender, EventArgs e)
        {
            string pid = Request.QueryString["pid"];
            string wid = Request.QueryString["wid"];

            if (!string.IsNullOrEmpty(pid) && !string.IsNullOrEmpty(wid))
            {
                Valuer v = new Valuer();
                v.SavePageObjects(this.Page, pid, "kneeosteoarthritisPain", wid);
                Response.Redirect("kneeosteoarthritisPain.aspx?pid=" + pid + "&wid=" + wid);
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string pid = Request.QueryString["pid"];

            if (!string.IsNullOrEmpty(pid))
            {
                Valuer v   = new Valuer();
                string wid = v.GetNewWhichId(pid, "distalfemoralfx");
                v.SavePageObjects(this.Page, pid, "distalfemoralfx", wid);
                Response.Redirect("distalfemoralfx.aspx?pid=" + pid + "&wid=" + wid);
            }
        }
Exemple #7
0
        protected void btnEdit_Click(object sender, EventArgs e)
        {
            string pid = Request.QueryString["pid"];
            string wid = Request.QueryString["wid"];

            if (!string.IsNullOrEmpty(pid) && !string.IsNullOrEmpty(wid))
            {
                Valuer v = new Valuer();
                v.SavePageObjects(this.Page, pid, "VarusValgusDeformity", wid);
                Response.Redirect("VarusValgusDeformity.aspx?pid=" + pid + "&wid=" + wid);
            }
        }
        internal static void Issue052_ValuerPostCustomizable(Fake <CompareHint> hint, Data item1, Data item2)
        {
            IValuer valuer = new Valuer(false);

            hint.Setup("Supports",
                       new object[] { item1, item2, Arg.LambdaAny <ValuerChainer>() },
                       Behavior.Returns(true, Times.Once));
            hint.Setup("Compare",
                       new object[] { item1, item2, Arg.LambdaAny <ValuerChainer>() },
                       Behavior.Returns(Enumerable.Empty <Difference>(), Times.Once));

            valuer.AddHint(hint.Dummy);
            valuer.Equals(item1, item2).Assert().Is(true);
            hint.VerifyAll();
        }
Exemple #9
0
        public T Choose <Q>(Comparer <Q> comp, Valuer <Q> fn, Q current)
        {
            var ret = default(T);

            // Each item in the list will have a function "fn" be
            // called to get a value to compare with the other items
            foreach (T c in this)
            {
                var now = fn(c);

                // If the comparator tells us now is better than the
                // current "current" variable, store the return for
                // later and update the "current" variable.
                if (comp(now, current))
                {
                    current = now;
                    ret     = c;
                }
            }

            return(ret);
        }
Exemple #10
0
 public T Most(Valuer <float> fn)
 {
     return(Choose((f1, f2) => f1 > f2, fn, float.NegativeInfinity));
 }
Exemple #11
0
 public T Least(Valuer <float> fn)
 {
     return(Choose((f1, f2) => f1 < f2, fn, float.PositiveInfinity));
 }
Exemple #12
0
 /// <summary>Verifies value is &lt; <paramref name="expected"/> or equals by value.</summary>
 /// <exception cref="AssertException">If value is &gt; <paramref name="expected"/>.</exception>
 /// <inheritdoc cref="HandleMathCheck"/>
 public virtual AssertChainer <T> LessThanOrIs(IComparable expected, string details = null)
 {
     return(Valuer.Equals(Value, expected)
         ? ToChainer()
         : LessThanOrEqualTo(expected, details));
 }