/// <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); }
/// <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."); } }
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"); } }
/// <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); }
/// <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); }
/// <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); }
internal void Success (IEnumerable<ITaskItem> items) { Items = items.ToArray (); ResultCode = TargetResultCode.Success; }
internal void Skip () { ResultCode = TargetResultCode.Skipped; }
internal void Failure (Exception exception) { this.Exception = exception; ResultCode = TargetResultCode.Failure; }
internal void Success(IEnumerable <ITaskItem> items) { Items = items.ToArray(); ResultCode = TargetResultCode.Success; }
internal void Skip() { ResultCode = TargetResultCode.Skipped; }
internal void Failure(Exception exception) { this.Exception = exception; ResultCode = TargetResultCode.Failure; }