コード例 #1
0
        public void DoublesGetRounded(double input, string expected)
        {
            var tested = new InvariantCultureRoundingFormat();
            var result = tested.Format("", input, null);

            Assert.Equal(expected, result);
        }
コード例 #2
0
        public void StringsGetThroughWhenUsingAppendFormat(string input)
        {
            var tested = new InvariantCultureRoundingFormat();

            var stb = new StringBuilder();

            stb.AppendFormat(tested, "{0}", input);
            Assert.Equal(input.ToString(), stb.ToString());
        }
コード例 #3
0
ファイル: Stats.cs プロジェクト: PFalkowski/OnTheFlyStats
        public override string ToString()
        {
            var numericFormat = new InvariantCultureRoundingFormat();
            var stb           = new StringBuilder();

            stb.AppendFormat(numericFormat, "μ={0}\t", Average);
            stb.AppendFormat(numericFormat, "Min={0}\t", Min);
            stb.AppendFormat(numericFormat, "Max={0}\t", Max);
            stb.AppendFormat(numericFormat, "∑={0}\t", Sum);
            stb.AppendFormat(numericFormat, "N={0}\t", N);
            stb.AppendFormat(numericFormat, "σ={0}\t", PopulationStandardDeviation);
            stb.AppendFormat(numericFormat, "σ²={0}\t", PopulationVariance);
            stb.AppendFormat(numericFormat, "SEM={0}", StandardError);

            return(stb.ToString());
        }