public void TestSecondGroupTask1() { //Arrange string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"TestSecondGroupTask1.txt"); string path2 = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"AnswersSecondGroupTask1.txt"); //Act var result = SecondGroup.Task1(path); List <int> list = new List <int>(); int number = 0; string[] array = File.ReadAllText(path2).Split(' '); foreach (var it in array) { if (Int32.TryParse(it, out number)) { list.Add(number); Console.WriteLine(number); } else { throw new ArgumentException(String.Format("{0} is not number", it)); } } //Assert CollectionAssert.AreEqual(list, result); }
public AstroAntManager(string[] firstGroup, string[] secondGroup) : this() { for (int i = 0; i < firstGroup.Length; i++) { var astroAnt = new AstroAnt(firstGroup[i], firstGroupIndex, firstGroup.Length - i); FirstGroup.Add(astroAnt); } for (int i = 0; i < secondGroup.Length; i++) { var astroAnt = new AstroAnt(secondGroup[i], secondGroupIndex, i + 1); SecondGroup.Add(astroAnt); } OverstepStatus.AddRange(FirstGroup); OverstepStatus.AddRange(SecondGroup); }
public AstroAntManager(int firstGroupSize, int secondGroupSize) : this() { for (int i = 0; i < firstGroupSize; i++) { var ant = new AstroAnt("green" + (i + 1), firstGroupIndex, i + 1); FirstGroup.Add(ant); } FirstGroup = FirstGroup.OrderByDescending(a => a.GroupPosition).ToList(); for (int i = 0; i < secondGroupSize; i++) { var ant = new AstroAnt("blue" + (i + 1), secondGroupIndex, i + 1); SecondGroup.Add(ant); } SecondGroup = SecondGroup.OrderBy(a => a.GroupPosition).ToList(); OverstepStatus.AddRange(FirstGroup); OverstepStatus.AddRange(SecondGroup); }
public void TestSecondGroupTask2() { //Arrange string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"TestSecondGroupTask2.txt"); string path2 = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"AnswersSecondGroupTask2.txt"); //Act var result = SecondGroup.Task2(path); List <string> list = new List <string>(); string[] array = File.ReadAllText(path2).Split(' '); foreach (var it in array) { list.Add(it); } //Assert CollectionAssert.AreEqual(list, result); }