public void Should_Create_A_Point(int xToTest, int yTotest) { var point = new Point(xToTest, yTotest); Assert.IsNotNull(point); Assert.AreEqual(point.X, xToTest); Assert.AreEqual(point.Y, yTotest); Assert.IsTrue(point.ToString().Contains(xToTest.ToString())); Assert.IsTrue(point.ToString().Contains(yTotest.ToString())); }
public void Should_Create_A_Default_Valuated_Point() { var point = new Point(); Assert.IsNotNull(point); Assert.AreEqual(point.X, 0); Assert.AreEqual(point.Y, 0); Assert.IsTrue(point.ToString().Contains("0")); }
private static string FindPath(Point from, Point to) { string path = to.ToString() + "\"]"; while (!from.Equals(to)) { List <Point> currentwave = new List <Point> { from }; while (!CheckTo(currentwave, to)) { List <Point> nextvawe = new List <Point>(); foreach (Point nextpoint in currentwave) { foreach (Point offset in horseSteps) { Point p = ShiftPoint(nextpoint, offset); p.from = nextpoint.ToString(); /* * здесь можно вставить проверку не занято ли поле с координатами р * */ nextvawe.Add(p); } currentwave = nextvawe; } } path = "\"" + foundedFrom + "\"," + path; to = ParsePoint(foundedFrom); } return("[" + path); }
static void Main(string[] args) { Point pt = new Point(5, 10); Console.WriteLine(pt.ToString()); }