Changeset 8088
- Timestamp:
- 06/22/12 11:25:12 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/ToStringTest.cs
r7915 r8088 20 20 #endregion 21 21 22 using System; 22 23 using System.Linq; 23 24 using HeuristicLab.Core; … … 29 30 public class ToStringTest { 30 31 32 private TestContext testContextInstance; 33 /// <summary> 34 ///Gets or sets the test context which provides 35 ///information about and functionality for the current test run. 36 ///</summary> 37 public TestContext TestContext { 38 get { 39 return testContextInstance; 40 } 41 set { 42 testContextInstance = value; 43 } 44 } 45 31 46 // Use ClassInitialize to run code before running the first test in the class 32 47 [ClassInitialize] … … 37 52 [TestMethod] 38 53 public void TestToString() { 54 bool success = true; 39 55 // just test for all IItems that the ToString method doesn't throw an exception 40 56 foreach (object item in ApplicationManager.Manager.GetInstances(typeof(IItem))) { 41 item.ToString(); 57 try { 58 item.ToString(); 59 } 60 catch (Exception e) { 61 TestContext.WriteLine(item.GetType() + " throws a " + e.GetType() + " in the ToString method."); 62 success = false; 63 } 42 64 } 65 Assert.IsTrue(success, "There are potential errors in the ToString methods of objects."); 43 66 } 44 67 }
Note: See TracChangeset
for help on using the changeset viewer.