static void Main(string[] args) { Console.WriteLine("Task 0.1 SEQUENCE:"); Console.WriteLine("Enter sequence border:"); int border = int.Parse(Console.ReadLine()); Task01.SequenceDisplay(border); Console.WriteLine("Task 0.2 SEQUENCE:"); Console.WriteLine("Enter number to check:"); int num = int.Parse(Console.ReadLine()); Task02.isPrimeDisplay(num); Console.WriteLine("Task 0.3 SQUARE:"); Console.WriteLine("Enter square size:"); int sqSize = int.Parse(Console.ReadLine()); Task03.Square(sqSize); Console.WriteLine("Task 0.4(0.5) ARRAY:"); Console.WriteLine("Enter number of arrays:"); int numArr = int.Parse(Console.ReadLine()); Task04.ArrayDisplay(numArr); }
/// <summary> /// Расчет растояния м-у двумя точками /// </summary> private static void CalcDistanceV2() { int[] x = new int[2] { 0, 0 }; int[] y = new int[2] { 0, 0 }; for (int i = 0; i < x.Length; i++) { Console.WriteLine("введите координату х" + (i + 1)); x[i] = Task01.CheckingInputasInt(); } for (int i = 0; i < y.Length; i++) { Console.WriteLine("введите координату y" + (i + 1)); y[i] = Task01.CheckingInputasInt(); } double r = Math.Sqrt(Math.Pow(x[1] - x[0], 2) + Math.Pow(y[1] - y[0], 2)); Console.WriteLine($"Расстояние между координатамми равно: {r:f2}"); Console.ReadKey(); }
public void GetKeyAndDepth_JsonString_ReturnsValidOutput() { StringBuilder expected = new StringBuilder(); expected.AppendLine("key1 1"); expected.AppendLine("key2 1"); expected.AppendLine("key3 2"); expected.AppendLine("key4 2"); expected.AppendLine("key5 3"); string jsonString = @"{ 'key1': 1, 'key2': { 'key3': 1, 'key4': { 'key5': 4 } } }"; JavaScriptSerializer serializer = new JavaScriptSerializer(); Dictionary <string, object> input = serializer.Deserialize <Dictionary <string, object> >(jsonString); string actual = Task01.GetKeyAndDepth(input); Assert.AreEqual(expected.ToString(), actual); }
public void GetKeyAndDepth_WhenInputIsNotValid02() { StringBuilder expected = new StringBuilder(); expected.AppendLine("key1 1"); expected.AppendLine("key2 1"); expected.AppendLine("key3 2"); expected.AppendLine("key4 2"); Dictionary <string, object> input = new Dictionary <string, object> { { "key1", 1 }, { "key2", new Dictionary <string, object> { { "key3", 1 }, { "key4", new Dictionary <string, object> { { "key5", 4 } } } } } }; Assert.AreNotEqual(expected.ToString(), Task01.GetKeyAndDepth(input)); }
public void GetKeyAndDepth_Dictionary_ReturnsValidOutput() { StringBuilder expected = new StringBuilder(); expected.AppendLine("key1 1"); expected.AppendLine("key2 1"); expected.AppendLine("key3 2"); expected.AppendLine("key4 2"); expected.AppendLine("key5 3"); Dictionary <string, object> input = new Dictionary <string, object> { { "key1", 1 }, { "key2", new Dictionary <string, object> { { "key3", 1 }, { "key4", new Dictionary <string, object> { { "key5", 4 } } } } } }; string actual = Task01.GetKeyAndDepth(input); Assert.AreEqual(expected.ToString(), actual); }
public void FindingGreatestDevisorTest(int a, int b, int expected) { Task01 task01 = new Task01(); int actual = task01.FindingGreatestDevisor(a, b); Assert.AreEqual(expected, actual); }
public void Task01IsSum121() { Task01 task = new Task01(); Int32 res = task.Run(); Assert.AreEqual(121, res); }
public static void CalcIMT() { Console.WriteLine("введите вес в кг"); double heihgt = Task01.CheckingInputasDouble(); Console.WriteLine("введите рост в см"); double weight = Task01.CheckingInputasDouble() / 100; double imt = heihgt / (weight * weight); Console.WriteLine($"Вес: {heihgt}кг ,Рост: {weight:f2}м , ИМТ: {imt:f1}"); Console.ReadKey(); }
public void CheckInsertNumberArgumentOutOfRangeException(int a, int b, int i, int j) { Assert.That(() => Task01.InsertNumber(a, b, i, j), Throws.TypeOf <ArgumentOutOfRangeException>()); }
public int CheckInsertNumber(int a, int b, int i, int j) { return(Task01.InsertNumber(a, b, i, j)); }
public void Test01Distance(Double x1, Double y1, Double x2, Double y2, Double answer) { Double res = Task01.DistanceBetweenTwoPoints(x1, y1, x2, y2); Assert.AreEqual(answer, res); }
public void CheckFindNthRootArgumentOutOfRange(double number, int degree, double precision) { Assert.That(() => Task01.FindNthRoot(number, degree, precision), Throws.TypeOf <ArgumentOutOfRangeException>()); }
public void CheckFindingNthRoot(double number, int degree, double precision, double expected) { double result = Task01.FindNthRoot(number, degree, precision); Assert.That(Math.Abs(expected - result), Is.LessThan(precision)); }