Index: visual_studio/NativeClientVSAddIn/UnitTests/TestUtilities.cs |
diff --git a/visual_studio/NativeClientVSAddIn/UnitTests/TestUtilities.cs b/visual_studio/NativeClientVSAddIn/UnitTests/TestUtilities.cs |
index 6bc311029378cde0d518845e806515c5e7aabc05..27941426fb325c54a8d4f43f0ca1014d6319d639 100644 |
--- a/visual_studio/NativeClientVSAddIn/UnitTests/TestUtilities.cs |
+++ b/visual_studio/NativeClientVSAddIn/UnitTests/TestUtilities.cs |
@@ -115,6 +115,10 @@ namespace UnitTests |
NativeClientVSAddIn.Strings.NaClPlatformName, naclCopyFrom, true); |
} |
+ // Set the active solution configuration to Debug|NaCl. |
+ SetSolutionConfiguration( |
+ dte, BlankNaClProjectUniqueName, "Debug", NativeClientVSAddIn.Strings.NaClPlatformName); |
+ |
proj.Save(); |
dte.Solution.SaveAs(newSolution); |
} |
@@ -130,6 +134,27 @@ namespace UnitTests |
} |
/// <summary> |
+ /// Ensures that the add-in is configured to load on start. If it isn't then some tests may |
+ /// unexpectedly fail, this check helps catch that problem early. |
+ /// </summary> |
+ /// <param name="dte">The main Visual Studio interface.</param> |
+ /// <param name="addInName">The name of the add-in to check if loaded.</param> |
+ public static void AssertAddinLoaded(DTE2 dte, string addInName) |
+ { |
+ bool found = false; |
+ foreach (AddIn addin in dte.AddIns) |
+ { |
+ if (addin.Connected && addInName.Equals(addin.Name)) |
+ { |
+ found = true; |
+ break; |
+ } |
+ } |
+ |
+ Assert.IsTrue(found, "Add-in is not configured to load on start."); |
+ } |
+ |
+ /// <summary> |
/// This returns the text contained in the given output window pane. |
/// </summary> |
/// <param name="pane">Pane to get text from.</param> |
@@ -337,6 +362,29 @@ namespace UnitTests |
} |
/// <summary> |
+ /// Tests that a given property is not null or empty. |
+ /// </summary> |
+ /// <param name="configuration">Gives the platform and configuration type</param> |
+ /// <param name="pageName">Property page name where property resides.</param> |
+ /// <param name="propertyName">Name of the property to check.</param> |
+ public static void AssertPropertyIsNotNullOrEmpty( |
+ VCConfiguration configuration, |
+ string pageName, |
+ string propertyName) |
+ { |
+ IVCRulePropertyStorage rule = configuration.Rules.Item(pageName); |
+ string propertyValue = rule.GetUnevaluatedPropertyValue(propertyName); |
+ |
+ string message = string.Format( |
+ "{0} was null or empty. Page: {1}, Configuration: {2}", |
+ propertyName, |
+ pageName, |
+ configuration.ConfigurationName); |
+ |
+ Assert.IsFalse(string.IsNullOrEmpty(propertyValue), message); |
+ } |
+ |
+ /// <summary> |
/// Extends the string class to allow checking if a string contains another string |
/// allowing a comparison type (such as case-insensitivity). |
/// </summary> |