コード例 #1
0
		public void SelectBreadthFirst_ChildrenSelectorNull ()
		{
			var root = new TreeNode<int>[0];
			Func<TreeNode<int>, IEnumerable<TreeNode<int>>> childrenSelector = null;
			root.SelectBreadthFirst (x => x.Value, childrenSelector);
		}
コード例 #2
0
		public void SelectBreadthFirst ()
		{
			#region SelectBreadthFirst
			TreeNode<int>[] root = new TreeNode<int>[] {
				new TreeNode<int> {
					Value = 1, Children = new [] {
						new TreeNode<int> { Value = 2 },
						new TreeNode<int> {
							Value = 3, Children = new [] {
								new TreeNode<int> { Value = 5 },
							}
						},
						new TreeNode<int> { Value = 4 },
					}
				},
				new TreeNode<int> { Value = -1 },
			};
			IEnumerable<int> values = root
				.SelectBreadthFirst (x => x.Value, x => x.Children);
			AssertAreSame (new[]{ 1, 2, 3, 4, 5, -1 }, values);
			#endregion
		}
コード例 #3
0
		public void SelectBreadthFirst_ValueSelectorNull ()
		{
			var root = new TreeNode<int>[0];
			Func<TreeNode<int>, int> valueSelector = null;
			root.SelectBreadthFirst (valueSelector, x => x.Children);
		}