예제 #1
0
        public void Constructor_GivenNullSchemeData_ArgumentNullExceptionExpected()
        {
            Action act = () =>
            {
                var aatfSchemeData = new AatfObligatedData(A.Dummy <AatfData>(), null);
            };

            act.Should().Throw <ArgumentNullException>();
        }
예제 #2
0
        private void SetObligatedValues(ReturnData source)
        {
            if (source.Aatfs != null)
            {
                foreach (var aatf in source.Aatfs)
                {
                    var weeeReceivedData = source.ObligatedWeeeReceivedData.Where(s => s.Aatf.Id == aatf.Id).ToList();
                    var weeeReusedData   = source.ObligatedWeeeReusedData.Where(s => s.Aatf.Id == aatf.Id).ToList();
                    var weeeSentOnData   = source.ObligatedWeeeSentOnData.Where(s => s.Aatf.Id == aatf.Id).ToList();

                    var schemeData = new List <AatfSchemeData>();

                    foreach (var scheme in source.SchemeDataItems)
                    {
                        var schemeList = weeeReceivedData.Where(s => s.Scheme.Id == scheme.Id && s.Aatf.Id == aatf.Id).ToList();

                        var obligatedReceivedValues = new ObligatedCategoryValue
                        {
                            B2B = tonnageUtilities.SumObligatedValues(schemeList).B2B,
                            B2C = tonnageUtilities.SumObligatedValues(schemeList).B2C
                        };

                        var aatfSchemeData = new AatfSchemeData(scheme, obligatedReceivedValues, scheme.ApprovalName);
                        schemeData.Add(aatfSchemeData);
                    }

                    var obligatedData = new AatfObligatedData(aatf, schemeData)
                    {
                        WeeeReceived = tonnageUtilities.SumObligatedValues(weeeReceivedData),
                        WeeeReused   = tonnageUtilities.SumObligatedValues(weeeReusedData),
                        WeeeSentOn   = tonnageUtilities.SumObligatedValues(weeeSentOnData)
                    };

                    AatfObligatedData.Add(obligatedData);
                }
            }
        }