Changeset 1705 for trunk/sources/HeuristicLab.Persistence/UnitTests
- Timestamp:
- 04/29/09 15:32:59 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Persistence/UnitTests/UseCases.cs
r1701 r1705 38 38 } 39 39 40 public class NonDefaultConstructorClass { 41 [Storable] 42 int value; 43 public NonDefaultConstructorClass(int value) { 44 this.value = value; 45 } 46 } 47 40 48 public class IntWrapper { 41 49 … … 100 108 [Storable] 101 109 public int[] i = new[] { 3, 4, 5, 6 }; 102 [Storable(Name ="Test String")]110 [Storable(Name = "Test String")] 103 111 public string s; 104 112 [Storable] … … 178 186 179 187 [TestCleanup()] 180 public void ClearTempFile() { 188 public void ClearTempFile() { 181 189 StreamReader reader = new StreamReader(tempFile); 182 190 string s = reader.ReadToEnd(); … … 210 218 Assert.AreEqual( 211 219 DebugStringGenerator.Serialize(r), 212 DebugStringGenerator.Serialize(newR)); 220 DebugStringGenerator.Serialize(newR)); 213 221 Assert.AreSame(newR, newR.selfReferences[0]); 214 222 Assert.AreNotSame(r, newR); … … 223 231 Assert.AreEqual(r.intList[0], 9); 224 232 Assert.AreEqual(r.intList[1], 8); 225 Assert.AreEqual(r.intList[2], 7); 233 Assert.AreEqual(r.intList[2], 7); 226 234 Assert.AreEqual(r.multiDimArray[0, 0], 5); 227 235 Assert.AreEqual(r.multiDimArray[0, 1], 4); … … 231 239 Assert.AreEqual(r.multiDimArray[1, 2], 6); 232 240 Assert.IsFalse(r.boolean); 233 Assert.IsTrue((DateTime.Now - r.dateTime).TotalSeconds < 10); 241 Assert.IsTrue((DateTime.Now - r.dateTime).TotalSeconds < 10); 234 242 Assert.AreEqual(r.kvp.Key, "string key"); 235 243 Assert.AreEqual(r.kvp.Value, 321); … … 486 494 } 487 495 496 [TestMethod] 497 public void NonDefaultConstructorTest() { 498 NonDefaultConstructorClass c = new NonDefaultConstructorClass(1); 499 try { 500 XmlGenerator.Serialize(c, tempFile); 501 Assert.Fail("Exception not thrown"); 502 } catch (PersistenceException) { 503 } 504 } 505 488 506 [ClassInitialize] 489 507 public static void Initialize(TestContext testContext) {
Note: See TracChangeset
for help on using the changeset viewer.