public void LoginWrongInfoTest()
        {
            Scraper scraper = new Scraper();

            bool loginSuccess = scraper.Login("D14127051", "wrongpassword");

            Assert.IsFalse(loginSuccess, "Login() returned true");
        }
        public void LoginCorrectInfoTest()
        {
            Scraper scraper = new Scraper();

            bool loginSuccess = scraper.Login("D14127051", GetLoginPassword());

            Assert.IsTrue(loginSuccess, "Login() returned false");
            Assert.IsTrue(scraper.Initialized, "Scraper not initialized after login");
        }
        public void PopulateModulesTest()
        {
            Scraper scraper = new Scraper();
            scraper.Login("D14127051", GetLoginPassword());
            List<string> expectedModuleNames = new List<string>()
            {
                "CIDT265-2012-14: Course Information DT265",
                "CMPU4065-A: Enterprise Application Development",
                "CMPU4066-B: Object Oriented Software Development 2",
            };

            //Act
            scraper.PopulateModules();
            List<string> moduleNames = scraper.GetModuleNames();

            // Assert

            Assert.IsTrue(moduleNames.Count > 0, "No modules found");   // Some modules were found
            Assert.IsTrue(moduleNames.All(expectedModuleNames.Contains), "Not all expected modules found"); // All expected modules are found
        }
예제 #4
0
        // Commented out as program now runs in MainGUI.
        //public static void Main(string[] args)
        //{
        //    DisplayWelcome();
        //    Initialize();
        //    menuOptions = new Dictionary<char, string>
        //    {
        //        { '1', "Download Content" },
        //        { '2', "View Content" },
        //        { '3', "Change Output Direcctory" },
        //        { '4', "Check For New Content" },
        //        { 'Q', "Quit" }
        //    };
        //    DisplayMenu();
        //    char choice = GetMenuChoice();
        //    while (choice != 'Q')
        //    {
        //        switch(choice)
        //        {
        //            case '1': DownloadContent(); break;
        //            case '2': ViewContent(); break;
        //            case '3': ChangeOutputDir(); break;
        //            case '4': CheckNewContent(); break;
        //        }
        //        DisplayMenu();
        //        choice = GetMenuChoice();
        //    }
        //    Console.WriteLine("Goodbye");
        //    scraper.SaveData();
        //    Console.ReadLine();
        //}
        public static void Initialize()
        {
            scraper = new Scraper();
            //Login
            while (!Login())
            {
                Console.WriteLine("Invalid login. Please try again.\n");
            }
            Console.WriteLine("Login successful!\n");

            //Populate Content

            if (scraper.LoadData())
            {
                Console.WriteLine("Loading data from previous session...\n");
            }
            else
            {
                Console.WriteLine("Populating content data from webcourses. Please wait...");
                scraper.PopulateAllData();
                Console.WriteLine("\nContent population complete\n");
            }
            Console.WriteLine("Modules found: ");
            DisplayModules(scraper.GetModuleNames());
            Console.WriteLine();
            Console.WriteLine("Current Output Directory: " + scraper.OutputDirectory);
            Console.WriteLine();
        }
 public LoginForm(Scraper scraper)
 {
     InitializeComponent();
     this.scraper = scraper;
 }
예제 #6
0
 public LoginForm(Scraper scraper)
 {
     InitializeComponent();
     this.scraper = scraper;
 }