public void Orphan_Well_Is_Reassigned() { ApplicationServices appServ = new ApplicationServices(); Well g = new Well("Well G", new Point(2000, 2000), new Point(1, 1)); appServ.AddWell(g); Group ge = new Group("Group G", new Point(2000, 2000), 1); appServ.AddGroup(ge); appServ.CheckOrphanWells(); bool expected = true; bool actual = g.GetUniqueName().Contains("Group G"); Assert.AreEqual(expected, actual); }
/// <summary> /// Application's entry point, controls the flow of the program. /// </summary> static void Main() { int opt = -1; do { Console.WriteLine("Select an option:\n1-Load a CSV file\n2-Print loaded content\n0-Exit"); Console.Write("Option: "); bool inpt = int.TryParse(Console.ReadLine(), out opt); if (!inpt) { opt = -1; } ApplicationServices appServ = new ApplicationServices(); switch (opt) { case 1: FileManager fm = InitializeFileManager(); String[] lines = fm.ReadAllLines(); List <int> wIndexs = CreateGroups(lines, fm.DELIMITER); //Assumption: Several files can be loaded in sequence and Oprhan Wells should be reassigned //If more than one file has been loaded in the same program run, check to see if old Wells don't belong to newly added groups if (appServ.GetLoadedFileCounter() > 1) { appServ.CheckOrphanWells(); } CreateWells(lines, fm.DELIMITER, wIndexs); Console.WriteLine("File loaded see report below"); Logger logger = Logger.GetInstance(); Console.Write(logger); logger.Clear(); break; case 2: Console.WriteLine("========================================"); foreach (Group g in appServ.GetGroups()) { Console.WriteLine(g); } Console.WriteLine(); foreach (Well w in appServ.GetWells()) { Console.WriteLine(w); } Console.WriteLine("========================================"); break; case 0: break; default: Console.WriteLine("\nInvalid Option\n"); break; } } while (opt != 0); }