public void GetDecimalCount_10()
        {
            decimal d      = 173.01234567890M;
            var     result = LangUtilities.GetDecimalCount(d);

            Assert.AreEqual(10, result);
        }
        public void GetDecimalCount_1()
        {
            decimal d      = 14.5M;
            var     result = LangUtilities.GetDecimalCount(d);

            Assert.AreEqual(1, result);
        }
Beispiel #3
0
        /// <summary>
        /// Validates an object and returns and outputs results to debug
        /// </summary>
        public static ValidationResultSet Validate(Object o)
        {
            var context = new ValidationContext(o);
            var results = new HashSet <ValidationResult>();
            var result  = new ValidationResultSet();

            result.IsValid = Validator.TryValidateObject(o, context, result.Results, true);
            Debug.Write(LangUtilities.TextWriterToString((s) => WriteResult(s, result.Results)));
            return(result);
        }
Beispiel #4
0
 public void Sort <T>(IList <T> list)
 {
     LangUtilities.Shuffle(list);
 }
        public void MethodNameForGeneric_Func()
        {
            String result = LangUtilities.MethodNameFor <LangUtilitiesTest, int>(p => p.SomeFunc0());

            Assert.AreEqual("SomeFunc0", result);
        }
        public void MethodNameForNonGeneric_Func1()
        {
            String result = LangUtilities.MethodNameFor(() => new LangUtilitiesTest().SomeFunc1(0));

            Assert.AreEqual("SomeFunc1", result);
        }
        public void MethodNameForNonGeneric_Action()
        {
            String result = LangUtilities.MethodNameFor(() => new LangUtilitiesTest().SomeMethod(null, null));

            Assert.AreEqual("SomeMethod", result);
        }
Beispiel #8
0
 public static String ActionNameFor <T>(Expression <Func <T, ActionResult> > actionExpression) where T : Controller
 {
     return(LangUtilities.MethodNameFor(actionExpression));
 }
Beispiel #9
0
 public static void WriteResultToDebug(IEnumerable <ValidationResult> results)
 {
     Debug.Write(LangUtilities.TextWriterToString((s) => WriteResult(s, results)));
 }