static TestCasesSet()
        {
            List <TestData> testDataList = new List <TestData>();

            MoneyValue salesValue = MoneyValue.Of(1000);
            SalesData  salesData  = new SalesData(salesValue, "Standard", false);

            testDataList.Add(new TestData(salesData, Points.Of(10)));

            MoneyValue salesValueIsWithdrawn = MoneyValue.Of(1000);
            SalesData  salesDataIsWithdrawn  = new SalesData(salesValueIsWithdrawn, "Standard", true);

            testDataList.Add(new TestData(salesDataIsWithdrawn, Points.Of(0)));

            MoneyValue salesValuePremium = MoneyValue.Of(1000);
            SalesData  salesDataPremium  = new SalesData(salesValuePremium, "Premium", false);

            testDataList.Add(new TestData(salesDataPremium, Points.Of(20)));

            MoneyValue salesValueProductWithoutPrice = MoneyValue.Of(1000);
            SalesData  salesDataProductWithoutPrice  =
                new SalesData(salesValueProductWithoutPrice, "Undefined", false);

            testDataList.Add(new TestData(salesDataProductWithoutPrice, Points.Of(0)));

            TestCases = testDataList.Select(x => new TestCaseData(x.SalesData, x.ExpectedPoints));
        }
        private static PriceList CreatePriceList()
        {
            List <PriceListItem> priceListItems = new List <PriceListItem>();

            priceListItems.Add(new PriceListItem("Standard", MoneyValue.Of(100)));
            priceListItems.Add(new PriceListItem("Premium", MoneyValue.Of(50)));
            PriceList priceList = new PriceList(priceListItems);

            return(priceList);
        }
        public static Points Calculate(SalesData salesData, PriceList priceList)
        {
            if (salesData.IsWithdrawn)
            {
                return(Points.Of(0));
            }

            MoneyValue moneyForOnePoint = priceList.GetValueForPointForProductCategory(salesData.ProductCategory);

            if (moneyForOnePoint != MoneyValue.Of(0))
            {
                return(Points.Of(salesData.Value / moneyForOnePoint));
            }

            return(Points.Of(0));
        }