NLite.Data.Test.NorthwindExecutionTest.TestMathTruncate C# (CSharp) Method

TestMathTruncate() private method

private TestMathTruncate ( ) : void
return void
        public virtual void TestMathTruncate()
        {
            // The difference between floor and truncate is how negatives are handled.  Truncate drops the decimals, 
            // therefore a truncated negative often has a more positive value than non-truncated (never has a less positive),
            // so Truncate(-3.4) is -3.0 and Truncate(3.4) is 3.0.
            var four = db.Customers.Where(c => c.CustomerID == "ALFKI").Sum(c => Math.Truncate((c.CustomerID == "ALFKI") ? 3.4 : 3.4));
            var six = db.Customers.Where(c => c.CustomerID == "ALFKI").Sum(c => Math.Truncate((c.CustomerID == "ALFKI") ? 3.6 : 3.6));
            var neg4 = db.Customers.Where(c => c.CustomerID == "ALFKI").Sum(c => Math.Truncate((c.CustomerID == "ALFKI") ? -3.4 : -3.4));
            AssertValue(Math.Truncate(3.4), four);
            AssertValue(Math.Truncate(3.6), six);
            AssertValue(Math.Truncate(-3.4), neg4);
        }
NorthwindExecutionTest