Esempio n. 1
0
        // --------------------------------------------------- Begin Data Analytics Testing ---------------------------------------------------
        //static void testSpendingPerCategory(long accID)
        //{
        //    AnalyticsService a = new AnalyticsService();

        //    Dictionary<string, decimal> spendingPerCategory = a.getAllTimeSpendingPerCategory(accID);

        //    // Print the spending per category
        //    Console.WriteLine("For user #" + accID);
        //    Console.WriteLine("\nSpending Per Category\n---------------------\n");
        //    foreach(string category in spendingPerCategory.Keys)
        //    {
        //        Console.WriteLine("   " + category + " : $" + spendingPerCategory[category]);
        //    }
        //}

        //static void testGetTotalSpending(long accID)
        //{
        //    AnalyticsService a = new AnalyticsService();
        //    decimal totalSpending = a.getTotalSpending(accID);

        //    // Print the total spending
        //    Console.WriteLine("For user #" + accID);
        //    Console.WriteLine("   Total spending: $" + totalSpending);
        //}

        //static void testCategoryBreakdown(long accID)
        //{
        //    AnalyticsService a = new AnalyticsService();
        //    Dictionary<string, Tuple<decimal, decimal>> breakdown = a.getCategoryBreakdown(accID);

        //    Console.WriteLine("For user #" + accID);
        //    Console.WriteLine("\nCategory Breakdown\n---------------\n");
        //    foreach(string category in breakdown.Keys)
        //    {
        //        Tuple<decimal, decimal> categoryVals = breakdown[category];
        //        Console.WriteLine("   " + category + ":");
        //        Console.WriteLine("      Category Total: $" + categoryVals.Item1);
        //        Console.WriteLine("      % of All Spending: " + categoryVals.Item2);
        //    }
        //}

        // ---------------------------------------------- Begin Subscription Testing ---------------------------------------------------------

        static void getSubscriptionNextID()
        {
            Console.WriteLine("\n-------------------- Test: Getting the next ID available, Write -------------------------");
            SubscriptionService subservice = new SubscriptionService();
            long SID = subservice.getNextAvailID();

            Console.WriteLine("Next available SID that can be assigned: " + SID + "\n");
        }
Esempio n. 2
0
        static Subscription testAddSubscription()
        {
            Console.WriteLine("\n-------------------- Test: Creating A New Subscription, Write -------------------------");
            // Query DB for the next avail ID
            SubscriptionService subservice = new SubscriptionService();
            long SID = subservice.getNextAvailID();

            Console.WriteLine("Next available SID that can be assigned: " + SID + "\n");

            //Create a new Subscription
            long tempRID   = 2;
            long tempAccID = 2;

            Subscription sampleSub = new Subscription(SID, tempAccID, tempRID, new DateTime(2021, 02, 20, 0, 0, 0), (decimal)14.99, SubscriptionFrequency.Weekly);


            //Print summary of Subscription that was just created
            Console.WriteLine("Subscription Summary: \n-----------------------");
            Console.WriteLine(sampleSub);
            subservice.write(sampleSub);

            return(sampleSub);
        }