| | |
| | | **
|
| | | ****************************************************************************/
|
| | |
|
| | | using Microsoft.VisualStudio.TestTools.UnitTesting;
|
| | | using System.Linq;
|
| | | using System.Collections.Generic;
|
| | | using Microsoft.Build.Framework;
|
| | | using Microsoft.Build.Utilities;
|
| | | using QtVsTools.QtMsBuild.Tasks;
|
| | | using Microsoft.VisualStudio.TestTools.UnitTesting;
|
| | |
|
| | | namespace QtVsTools.Test.QtMsBuild.Tasks
|
| | | {
|
| | | using QtVsTools.QtMsBuild.Tasks;
|
| | |
|
| | | [TestClass]
|
| | | public class Test_Join
|
| | | {
|
| | | ITaskItem[] LeftItems = new TaskItem[]
|
| | | readonly ITaskItem[] LeftItems = new TaskItem[]
|
| | | {
|
| | | new TaskItem("A", new Dictionary<string, string> {
|
| | | { "X", "foo" },
|
| | |
| | | { "Y", "3.14159" },
|
| | | }),
|
| | | };
|
| | |
|
| | | ITaskItem[] RightItems = new TaskItem[]
|
| | | readonly ITaskItem[] RightItems = new TaskItem[]
|
| | | {
|
| | | new TaskItem("A", new Dictionary<string, string> {
|
| | | { "Z", "foo" },
|
| | |
| | | // ---------------
|
| | |
|
| | | var criteria = new string[] { "Y" };
|
| | | ITaskItem[] result;
|
| | | Assert.IsTrue(
|
| | | Join.Execute(LeftItems, RightItems, out result, criteria));
|
| | | Join.Execute(LeftItems, RightItems, out ITaskItem[] result, criteria));
|
| | | Assert.IsTrue(result != null && result.Length == 3);
|
| | |
|
| | | Assert.IsTrue(result[0].GetMetadata("X") == "foo");
|
| | |
| | | // -------------------
|
| | |
|
| | | var criteria = new string[] { "ROW_NUMBER" };
|
| | | ITaskItem[] result;
|
| | | Assert.IsTrue(
|
| | | Join.Execute(LeftItems, RightItems, out result, criteria));
|
| | | Join.Execute(LeftItems, RightItems, out ITaskItem[] result, criteria));
|
| | | Assert.IsTrue(result != null && result.Length == 3);
|
| | |
|
| | | Assert.IsTrue(result[0].GetMetadata("X") == "foo");
|
| | |
| | | // -------------------
|
| | |
|
| | | var criteria = new string[] { "ROW_NUMBER", "Y" };
|
| | | ITaskItem[] result;
|
| | | Assert.IsTrue(
|
| | | Join.Execute(LeftItems, RightItems, out result, criteria));
|
| | | Join.Execute(LeftItems, RightItems, out ITaskItem[] result, criteria));
|
| | | Assert.IsTrue(result != null && result.Length == 0);
|
| | | }
|
| | |
|
| | |
| | | .ToArray();
|
| | |
|
| | | var criteria = new string[] { "ROW_NUMBER", "Y" };
|
| | | ITaskItem[] result;
|
| | | Assert.IsTrue(
|
| | | Join.Execute(newLeftItems, RightItems, out result, criteria));
|
| | | Join.Execute(newLeftItems, RightItems, out ITaskItem[] result, criteria));
|
| | | Assert.IsTrue(result != null && result.Length == 1);
|
| | |
|
| | | Assert.IsTrue(result[0].GetMetadata("X") == "zzz");
|
| | |
| | | // --------------------- A | bar | 99 B | bar | 99 | bar
|
| | | // --------------------- ----------------------
|
| | |
|
| | | ITaskItem[] result;
|
| | | Assert.IsTrue(
|
| | | Join.Execute(LeftItems, RightItems, out result));
|
| | | Join.Execute(LeftItems, RightItems, out ITaskItem[] result));
|
| | | Assert.IsTrue(result != null && result.Length == 4);
|
| | |
|
| | | Assert.IsTrue(result[0].GetMetadata("X") == "foo");
|