Exemple #1
0
        static void Tests()
        {
            // Initialize the quote
            ServerDB.InitQuote(10);

            // Update Quote
            ServerDB.UpdateQuote(5);

            if (ServerDB.GetQuote() != 5)
            {
                Console.WriteLine("Test Failed");
            }

            ServerDB.UpdateQuote(10);

            if (ServerDB.GetQuote() != 10)
            {
                Console.WriteLine("Test Failed");
            }

            // Register Users
            ServerDB.Register("uDavid", "David", "pass1");
            ServerDB.Register("uEdu", "Edu", "pass2");
            ServerDB.Register("uEdu", "x", "pass2");
            ServerDB.Register("uEdu", "Edu", "x");

            // Login
            if (ServerDB.Login("uEdu", "pass2") != "Edu")
            {
                Console.WriteLine("Test Failed");
            }

            if (ServerDB.Login("x", "pass2") != null)
            {
                Console.WriteLine("Test Failed");
            }

            if (ServerDB.Login("uEdu", "x") != null)
            {
                Console.WriteLine("Test Failed");
            }

            // Order
            List <int> diginotes = new List <int>();

            diginotes = ServerDB.InsertPurchaseOrder("uEdu", 6);
            diginotes = ServerDB.InsertSellingOrder("uDavid", 2);
            diginotes = ServerDB.InsertSellingOrder("uDavid", 2);
            diginotes = ServerDB.InsertSellingOrder("uDavid", 2);

            diginotes = ServerDB.InsertSellingOrder("uEdu", 6);
            diginotes = ServerDB.InsertPurchaseOrder("uDavid", 2);
            diginotes = ServerDB.InsertPurchaseOrder("uDavid", 2);
            diginotes = ServerDB.InsertPurchaseOrder("uDavid", 2);
        }
Exemple #2
0
 public string Login(string username, string password)
 {
     return(ServerDB.Login(username, password));
 }