示例#1
0
        /// <summary>
        /// Checks if the target results are as expected. This method can only be called for targets may be built as a result of building
        /// the requested / default / initial targets
        /// </summary>
        public void ValidateNonPrimaryTargetEndResult(string targetName, TargetResultCode expectedResultCode, string[] items)
        {
            BuildResult  result       = this.resultsCache.GetResultForRequest(this.buildRequest);
            TargetResult targetResult = (TargetResult)result[targetName];

            InternalValidateTargetEndResult(targetResult, expectedResultCode, items);
        }
示例#2
0
        /// <summary>
        /// Checks if the target results are as expected.
        /// </summary>
        private void InternalValidateTargetEndResult(TargetResult targetResult, TargetResultCode expectedResultCode, string[] items)
        {
            int foundCount = 0;

            Assert.AreEqual(expectedResultCode, targetResult.ResultCode, "Expected result is not the same as the received result");
            if (items != null)
            {
                foreach (string item in items)
                {
                    bool foundItemValue = false;

                    foreach (ITaskItem i in targetResult.Items)
                    {
                        if (item == i.ItemSpec)
                        {
                            foundItemValue = true;
                            foundCount++;
                            break;
                        }
                    }

                    Assert.IsTrue(foundItemValue, "Item not found in result");
                }

                Assert.IsTrue(foundCount == items.Length, "Total items expected was not the same as what was received.");
            }
        }
示例#3
0
 private ResultCode Convert(TargetResultCode buildResultCode)
 {
     switch (buildResultCode)
     {
         case TargetResultCode.Skipped:
             return ResultCode.Skipped;
         case TargetResultCode.Success:
             return ResultCode.Success;
         case TargetResultCode.Failure:
             return ResultCode.Failure;
         default:
             throw new ArgumentOutOfRangeException("buildResultCode");
     }
 }
示例#4
0
        /// <summary>
        /// Checks if the target results are as expected. This method can only be called for targets which were specifically requested
        /// to be built or the default/initial targets
        /// </summary>
        public void ValidateTargetEndResult(string targetName, TargetResultCode expectedResultCode, string[] items)
        {
            TargetResult targetResult = (TargetResult)this.buildResult[targetName];

            InternalValidateTargetEndResult(targetResult, expectedResultCode, items);
        }
示例#5
0
        /// <summary>
        /// Checks if the target results are as expected.
        /// </summary>
        private void InternalValidateTargetEndResult(TargetResult targetResult, TargetResultCode expectedResultCode, string[] items)
        {
            int foundCount = 0;

            Assert.AreEqual(expectedResultCode, targetResult.ResultCode, "Expected result is not the same as the received result");
            if (items != null)
            {
                foreach (string item in items)
                {
                    bool foundItemValue = false;

                    foreach (ITaskItem i in targetResult.Items)
                    {
                        if (item == i.ItemSpec)
                        {
                            foundItemValue = true;
                            foundCount++;
                            break;
                        }
                    }

                    Assert.IsTrue(foundItemValue, "Item not found in result");
                }

                Assert.IsTrue(foundCount == items.Length, "Total items expected was not the same as what was received.");
            }
        }
示例#6
0
 /// <summary>
 /// Checks if the target results are as expected. This method can only be called for targets which were specifically requested
 /// to be built or the default/initial targets
 /// </summary>
 public void ValidateTargetEndResult(string targetName, TargetResultCode expectedResultCode, string[] items)
 {
     TargetResult targetResult = (TargetResult)_buildResult[targetName];
     InternalValidateTargetEndResult(targetResult, expectedResultCode, items);
 }
示例#7
0
 /// <summary>
 /// Checks if the target results are as expected. This method can only be called for targets may be built as a result of building
 /// the requested / default / initial targets
 /// </summary>
 public void ValidateNonPrimaryTargetEndResult(string targetName, TargetResultCode expectedResultCode, string[] items)
 {
     BuildResult result = _resultsCache.GetResultForRequest(_buildRequest);
     TargetResult targetResult = (TargetResult)result[targetName];
     InternalValidateTargetEndResult(targetResult, expectedResultCode, items);
 }
示例#8
0
		internal void Success (IEnumerable<ITaskItem> items)
		{
			Items = items.ToArray ();
			ResultCode = TargetResultCode.Success; 
		}
示例#9
0
		internal void Skip ()
		{
			ResultCode = TargetResultCode.Skipped;
		}
示例#10
0
		internal void Failure (Exception exception)
		{
			this.Exception = exception;
			ResultCode = TargetResultCode.Failure;
		}
示例#11
0
 internal void Success(IEnumerable <ITaskItem> items)
 {
     Items      = items.ToArray();
     ResultCode = TargetResultCode.Success;
 }
示例#12
0
 internal void Skip()
 {
     ResultCode = TargetResultCode.Skipped;
 }
示例#13
0
 internal void Failure(Exception exception)
 {
     this.Exception = exception;
     ResultCode     = TargetResultCode.Failure;
 }