This project has moved and is read-only. For the latest updates, please go here.
2
Vote

Problem with group by data aggregation.

description

I have a problem with group by data aggregation. Bellow you can see a code that works fine with mssql database, but when i try to run unit test using Effort framework, it gives me an error "Incorrect number of arguments for constructor".
What is interesting, when I cut from "select" clause any 2 summary variables, it works fine.
I assume that Effort has a limitation for maximum 6 agregation column.
Am I right? Will it be corrected in future?

Linq query that raise an error:
var detailValues = (from detail in u.PromoActionPageDetails.Find(d => d.PromoActionId == promoAction.Id)
                                group detail by detail.PromoActionId into value
                                select new
                                {
                                    PromoActionId                   = value.Key,
                                    TurnoverEstimation              = value.Sum(v => v.PlannedQnty * v.PriceSaleAction),
                                    TurnoverReality                 = value.Sum(v => v.AdjustedQtty * v.PriceSaleAction),
                                    MarginEstimation                = value.Sum(v => v.PlannedQnty * v.PriceSaleAction / v.PricePurchaseAction),
                                    MarginReality                   = value.Sum(v => v.AdjustedQtty * v.PriceSaleAction / v.PricePurchaseAction),
                                    GrossProfitEstimation           = value.Sum(v => v.PlannedQnty * (v.PriceSaleAction - v.PricePurchaseAction)),
                                    GrossProfitReality              = value.Sum(v => v.AdjustedQtty * (v.PriceSaleAction - v.PricePurchaseAction)),
                                    ContributionEstimation          = value.Sum(v => v.SupplierContributionAmount),
                                    ContributionReality             = value.Sum(v => v.SupplierContributionAmount)
                                }).FirstOrDefault();

comments

Neeek wrote Nov 17, 2016 at 4:28 PM

Any news on this? I just updated the version of Effort I was using and now several unit tests are failing because of this issue.