public void TestLargestProductInASeries13Digits() { var task = new Task8(); int count = 13; Assert.AreEqual(23514624000, task.Run(count), $"Largest product of {count} digets in a series is incorrect"); }
public void TestLargestProductInASeries4Digits() { var task = new Task8(); int count = 4; Assert.AreEqual(5832, task.Run(count), $"Largest product of {count} digets in a series is incorrect"); }
static void Main(string[] args) { Task7.ExecuteTask(); Task8.ExecuteTask(); Task10.ExecuteTask(); Task11.ExecuteTask(); Task12.ExecuteTask(); }
/// <summary> /// The main. /// </summary> /// <param name="args"> /// The args. /// </param> private static void Main(string[] args) { Task1.Execute(); Task2.Execute(); Task3.Execute(); Task4.Execute(); Task5.Execute(); Task6.Execute(); Task7.Execute(); Task8.Execute(); Task9.Execute(); Task10.Execute(); }
/// <summary> /// The main. /// </summary> /// <param name="args"> /// The args. /// </param> private static void Main(string[] args) { Task2.ExtractArtists(FileName); Task3.ExtractArtistsXPath(FileName); Task4.DeleteAllAlbumsWithPriceMoreThan20(FileName); Task5.ExtractAllSongTitles(FileName); Task6.ExtractAllSongTitlesXpathLinq(FileName); Task7.CreateXmlFromTxtFile(TxtName); Task8.CreateAlbumXml(FileName); Task9.TraverseDirectory("../.."); Task10.TraverseDirectory("../.."); Task11.ExtractAlbumPrices(FileName); Task12.ExtractAlbumPricesLinq(FileName); Task14.ConvertXmlToXsl(FileName, XslName); Task16.GenerateXsdFile(FileName); }
public void MergeLayers_Test() { int width = 2; int height = 2; string input = "0222112222120000"; var intList = input.ToCharArray().Select(a => a - '0').ToList(); var layers = Task8.GetImage(width, height, intList); var result = Task8.MergeLayers(layers); var expectedResult = new[, ] { { 0, 1 }, { 1, 0 } }; result.ShouldBe(expectedResult); }
public void GetImage_Test() { int width = 3; int height = 2; string input = "123456789012"; var intList = input.ToCharArray().Select(a => a - '0').ToList(); var result = Task8.GetImage(width, height, intList); var expectedResult = new List <int[, ]>(); expectedResult.Add(new[, ] { { 1, 2, 3 }, { 4, 5, 6 } }); expectedResult.Add(new[, ] { { 7, 8, 9 }, { 0, 1, 2 } }); result.ShouldBe(expectedResult); }
public static void Main(string[] args) { Console.Write("Please select the task(1-11): "); int taskNumber; while (true) { try { taskNumber = int.Parse(Console.ReadLine()); if (taskNumber < 1 || taskNumber > 12) { throw new FormatException(); } break; } catch (FormatException) { Console.Write("Incorrect input, try again: "); } } switch (taskNumber) { case 1: Task1.Do(); Program.Main(args); break; case 2: Task2.Do(); Program.Main(args); break; case 3: Task3.Do(); Program.Main(args); break; case 4: Task4.Do(); Program.Main(args); break; case 5: Task5.Do(); Program.Main(args); break; case 6: Task6.Do(); Program.Main(args); break; case 7: Task7.Do(); Program.Main(args); break; case 8: Task8.Do(); Program.Main(args); break; case 9: Task9.Do(); Program.Main(args); break; case 10: Task10.Do(); Program.Main(args); break; } }
public void ArgumentOutOfRangeExceptionTests(int a) { Assert.Throws <ArgumentOutOfRangeException>(() => Task8.BisectionMethod(a)); }
public void BisectionMethodTest(int a, int expected) { int actual = Task8.BisectionMethod(a); Assert.AreEqual(expected, actual); }
public void SwapHalvesTest(int[] array, int[] expected) { int[] actual = Task8.SwapHalves(array); Assert.AreEqual(expected, actual); }
public static void Main() { /*----------1 задание------------------*/ string input = "154216"; Lexer L = new IntLexer(input); try { L.Parse(); } catch (LexerException e) { System.Console.WriteLine(e.Message); } input = "5.9"; L = new IntLexer(input); try { L.Parse(); } catch (LexerException e) { System.Console.WriteLine(e.Message); } /*----------2 задание------------------*/ input = "hggasasa"; L = new Task2(input); try { L.Parse(); } catch (LexerException e) { System.Console.WriteLine(e.Message); } input = "23hggasasa"; L = new Task2(input); try { L.Parse(); } catch (LexerException e) { System.Console.WriteLine(e.Message); } /*----------3 задание------------------*/ input = "-9976"; L = new Task3(input); try { L.Parse(); } catch (LexerException e) { System.Console.WriteLine(e.Message); } input = "09976"; L = new Task3(input); try { L.Parse(); } catch (LexerException e) { System.Console.WriteLine(e.Message); } /*----------4 задание------------------*/ input = "d4f5g6h7j8"; L = new Task4(input); try { L.Parse(); } catch (LexerException e) { System.Console.WriteLine(e.Message); } input = "78d4f5"; L = new Task4(input); try { L.Parse(); } catch (LexerException e) { System.Console.WriteLine(e.Message); } /*----------5 задание------------------*/ input = "d;u;b,j"; L = new Task5(input); try { L.Parse(); } catch (LexerException e) { System.Console.WriteLine(e.Message); } input = "dd;u;b,j"; L = new Task5(input); try { L.Parse(); } catch (LexerException e) { System.Console.WriteLine(e.Message); } /*----------6 задание------------------*/ input = "2 4 5 6"; L = new Task6(input); try { L.Parse(); } catch (LexerException e) { System.Console.WriteLine(e.Message); } input = "2 4 57 6"; L = new Task6(input); try { L.Parse(); } catch (LexerException e) { System.Console.WriteLine(e.Message); } /*----------7 задание------------------*/ input = "aa11b12cc"; L = new Task7(input); try { L.Parse(); } catch (LexerException e) { System.Console.WriteLine(e.Message); } input = "aaa11b124cc"; L = new Task7(input); try { L.Parse(); } catch (LexerException e) { System.Console.WriteLine(e.Message); } /*----------8 задание------------------*/ input = "3.1456"; L = new Task8(input); try { L.Parse(); } catch (LexerException e) { System.Console.WriteLine(e.Message); } input = "3.14.56"; L = new Task8(input); try { L.Parse(); } catch (LexerException e) { System.Console.WriteLine(e.Message); } input = "31456."; L = new Task8(input); try { L.Parse(); } catch (LexerException e) { System.Console.WriteLine(e.Message); } input = ".31456"; L = new Task8(input); try { L.Parse(); } catch (LexerException e) { System.Console.WriteLine(e.Message); } /*----------9 задание------------------*/ input = "'jijijij'"; L = new Task9(input); try { L.Parse(); } catch (LexerException e) { System.Console.WriteLine(e.Message); } input = "jijijij'"; L = new Task9(input); try { L.Parse(); } catch (LexerException e) { System.Console.WriteLine(e.Message); } input = "'jijijij"; L = new Task9(input); try { L.Parse(); } catch (LexerException e) { System.Console.WriteLine(e.Message); } /*----------10 задание------------------*/ input = "/*789876*/"; L = new Task10(input); try { L.Parse(); } catch (LexerException e) { System.Console.WriteLine(e.Message); } input = "/*"; L = new Task10(input); try { L.Parse(); } catch (LexerException e) { System.Console.WriteLine(e.Message); } input = "/*89"; L = new Task10(input); try { L.Parse(); } catch (LexerException e) { System.Console.WriteLine(e.Message); } Console.ReadKey(); }
public static string GetBookTitlesContaining(BookShopContext context, string input) { return(Task8.GetResult(context, input)); }