Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Tests/HeuristicLab.Persistence-3.3/StorableAttributeTests.cs @ 11152

Last change on this file since 11152 was 9778, checked in by abeham, 11 years ago

#2088: Added test attributes to persistence unit tests

File size: 1.8 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
23
24namespace HeuristicLab.Persistence.Tests {
25
26  [StorableClass]
27  class DemoClass {
28
29    [Storable(Name = "TestProperty", DefaultValue = 12)]
30    public object o = null;
31
32    [Storable]
33    public int x = 2;
34
35    public int y = 0;
36  }
37
38  [StorableClass]
39  class Base {
40    public string baseName;
41    [Storable]
42    public virtual string Name {
43      get { return "Base"; }
44      set { baseName = value; }
45    }
46  }
47
48  [StorableClass]
49  class Override : Base {
50    [Storable]
51    public override string Name {
52      get { return "Override"; }
53      set { base.Name = value; }
54    }
55  }
56
57  [StorableClass]
58  class Intermediate : Override {
59  }
60
61  [StorableClass]
62  class New : Intermediate {
63    public string newName;
64    [Storable]
65    public new string Name {
66      get { return "New"; }
67      set { newName = value; }
68    }
69  }
70}
Note: See TracBrowser for help on using the repository browser.