public Change MakePurchase(Purchase purchase)
        {
            // Randomize the change if divisible by 3. Yeah, it's weird, but I like it!
            // Note: % doesn't work on fractions, so shift the money to an integer for the test.
            if (purchase.ItemCost*100 % 3 == 0)
            {
                return _randomChangeStrategy.MakeChange(purchase.Payment - purchase.ItemCost);
            }

            return _minChangeStrategy.MakeChange(purchase.Payment - purchase.ItemCost);
        }
        private static void Main(string[] args)
        {
            var container = new Container(c => c.AddRegistry<AppScanRegistry>());
            var changeMaker = container.GetInstance<IPurchaseStrategy>();
            var fileProcessor = container.GetInstance<IFileProcessor>();

            string inputFilename = args.Length > 0 ? args[0] : "InputSample.csv";
            var dts = inputFilename + ".out" + DateTime.Now.ToString("yyyyMMddHHMMSS");
            string outputFilename = args.Length > 1 ? args[1] : dts;

            fileProcessor.ProcessFile(inputFilename, outputFilename, purchaseText =>
            {
                var purchase = new Purchase(purchaseText);
                var change = changeMaker.MakePurchase(purchase);
                Console.Out.Write(purchase + " => " + change + "\n");
                return change.ToString();
            });

            // SO that I can read it when I execute in the VS....
            Console.In.ReadLine();
        }
 public void it_should_display_the_object()
 {
     var purchase = new Purchase("2.00,3.00");
     Assert.AreEqual(purchase.ToString(),"P:3.00,C:2.00");
 }
 public void it_should_handle_the_happy_path()
 {
     var purchase = new Purchase("2.00,3.00");
     Assert.AreEqual(purchase.Payment,3M);
     Assert.AreEqual(purchase.ItemCost, 2M);
 }