Exemplo n.º 1
0
        public void GetMove_O_3Fields()
        {
            var field = Field.Create(0, 0, 0, @"
				......X...
				XXX....XXX
				XXXX...XXX"                );

            var generator = new MoveGenerator();
            var act       = generator.GetFields(field, Block.O).ToArray();

            var exp = new []
            {
                Field.Create(0, 0, 0, @"
					......X...
					XXX..XXXXX
					XXXX.XXXXX"                    ),
                Field.Create(0, 0, 0, @"
					...XX.X...
					XXXXX..XXX
					XXXX...XXX"                    ),
                Field.Create(0, 0, 0, @"
					......X...
					XXX.XX.XXX
					XXXXXX.XXX"                    ),
            };

            CollectionAssert.AreEqual(exp, act);
        }
Exemplo n.º 2
0
        private static void AssertGetFields(string[] exp, Block block)
        {
            var generator       = new MoveGenerator();
            var candidateFields = generator.GetMoves(TestData.Small, block).Select(candidate => candidate.Field.ToString()).ToArray();
            var fields          = generator.GetFields(TestData.Small, block).Select(field => field.ToString()).ToArray();

            foreach (var field in candidateFields)
            {
                Console.WriteLine('"' + field + '"' + ',');
            }

            foreach (var field in candidateFields)
            {
                Console.WriteLine(field.Replace("|", Environment.NewLine));
                Console.WriteLine();
            }
            Assert.AreEqual(block.ChildCount, candidateFields.Length, "GetMoves for {0} has the wrong number of answers.", block.Name);
            CollectionAssert.AreEqual(exp, candidateFields, "Moves");
            CollectionAssert.AreEqual(exp, fields, "Fields");
        }
		private static void AssertGetFields(string[] exp, Block block)
		{
			var generator = new MoveGenerator();
			var candidateFields = generator.GetMoves(TestData.Small, block).Select(candidate => candidate.Field.ToString()).ToArray();
			var fields = generator.GetFields(TestData.Small, block).Select(field => field.ToString()).ToArray();

			foreach (var field in candidateFields)
			{
				Console.WriteLine('"' + field + '"' + ',');
			}

			foreach (var field in candidateFields)
			{
				Console.WriteLine(field.Replace("|", Environment.NewLine));
				Console.WriteLine();
			}
			Assert.AreEqual(block.ChildCount, candidateFields.Length, "GetMoves for {0} has the wrong number of answers.", block.Name);
			CollectionAssert.AreEqual(exp, candidateFields, "Moves");
			CollectionAssert.AreEqual(exp, fields, "Fields");
		}
		public void GetMove_O_3Fields()
		{
			var field = Field.Create(0, 0, 0, @"
				......X...
				XXX....XXX
				XXXX...XXX");

			var generator = new MoveGenerator();
			var act = generator.GetFields(field, Block.O).ToArray();

			var exp = new [] 
			{
				 Field.Create(0, 0, 0, @"
					......X...
					XXX..XXXXX
					XXXX.XXXXX"),
				Field.Create(0, 0, 0, @"
					...XX.X...
					XXXXX..XXX
					XXXX...XXX"),
				 Field.Create(0, 0, 0, @"
					......X...
					XXX.XX.XXX
					XXXXXX.XXX"),
			};
			CollectionAssert.AreEqual(exp, act);
		}