Changeset 1684
- Timestamp:
- 04/28/09 13:58:49 (16 years ago)
- Location:
- trunk/sources/HeuristicLab.Persistence
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Persistence/3.3/Default/Decomposers/EnumDecomposer.cs
r1625 r1684 19 19 20 20 public IEnumerable<Tag> CreateMetaInfo(object obj) { 21 yield return new Tag(Enum. GetName(obj.GetType(), obj));21 yield return new Tag(Enum.Format(obj.GetType(), obj, "G")); 22 22 } 23 23 -
trunk/sources/HeuristicLab.Persistence/UnitTests/UseCases.cs
r1683 r1684 100 100 [Storable(DefaultValue = "default")] 101 101 public string uninitialized; 102 } 103 104 public enum SimpleEnum { one, two, three } 105 public enum ComplexEnum { one = 1, two = 2, three = 3 } 106 [FlagsAttribute] 107 public enum TrickyEnum { zero = 0, one = 1, two = 2 } 108 109 public class EnumTest { 110 [Storable] 111 public SimpleEnum simpleEnum = SimpleEnum.one; 112 [Storable] 113 public ComplexEnum complexEnum = (ComplexEnum)2; 114 [Storable] 115 public TrickyEnum trickyEnum = (TrickyEnum)15; 102 116 } 103 117 … … 422 436 } 423 437 438 [TestMethod] 439 public void Enums() { 440 EnumTest et = new EnumTest(); 441 et.simpleEnum = SimpleEnum.two; 442 et.complexEnum = ComplexEnum.three; 443 et.trickyEnum = TrickyEnum.two | TrickyEnum.one; 444 XmlGenerator.Serialize(et, tempFile); 445 EnumTest newEt = (EnumTest)XmlParser.DeSerialize(tempFile); 446 Assert.AreEqual(et.simpleEnum, SimpleEnum.two); 447 Assert.AreEqual(et.complexEnum, ComplexEnum.three); 448 Assert.AreEqual(et.trickyEnum, (TrickyEnum)3); 449 } 450 424 451 425 452 [ClassInitialize]
Note: See TracChangeset
for help on using the changeset viewer.