Datei: IntegrationTests/IntegrationTests/AbstractBaseTests.cs
Last Commit (9d1552b)
1 | // |
2 | // Copyright (c) 2002-2016 Mirko Matytschak |
3 | // (www.netdataobjects.de) |
4 | // |
5 | // Author: Mirko Matytschak |
6 | // |
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated |
8 | // documentation files (the "Software"), to deal in the Software without restriction, including without limitation |
9 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the |
10 | // Software, and to permit persons to whom the Software is furnished to do so, subject to the following |
11 | // conditions: |
12 | |
13 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions |
14 | // of the Software. |
15 | // |
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED |
17 | // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
18 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF |
19 | // CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. |
21 | |
22 | |
23 | using System; |
24 | using System.Collections; |
25 | using AbstractBaseTestClasses; |
26 | using NDO; |
27 | using NUnit.Framework; |
28 | |
29 | namespace NdoUnitTests |
30 | { |
31 | |
32 | ····[TestFixture] |
33 | public class AbstractBaseTests |
34 | ····{ |
35 | ········PersistenceManager pm; |
36 | |
37 | ········[SetUp] |
38 | ········public void Setup() |
39 | ········{ |
40 | ············this.pm = PmFactory.NewPersistenceManager(); |
41 | ········} |
42 | |
43 | |
44 | ········[TearDown] |
45 | ········public void TearDown() |
46 | ········{············ |
47 | ············IList l = pm.GetClassExtent(typeof(ABA)); |
48 | ············pm.Delete(l); |
49 | ············l = pm.GetClassExtent(typeof(ABB)); |
50 | ············pm.Delete(l); |
51 | ············pm.Dispose(); |
52 | ········} |
53 | |
54 | |
55 | ········[Test] |
56 | ········public void TestConcreteRel() |
57 | ········{ |
58 | ············ABA a = new ABA(); |
59 | ············a.MyString = "a"; |
60 | ············pm.MakePersistent(a); |
61 | ············ABB b = new ABB(); |
62 | ············b.MyString = "b"; |
63 | ············pm.MakePersistent(b); |
64 | ············pm.Save(); |
65 | ············b.AddA(a); |
66 | ············pm.Save(); |
67 | ············pm.UnloadCache(); |
68 | ············b = (ABB) pm.FindObject(b.NDOObjectId); |
69 | ············Assert.That(1 == b.MyA.Count, "Count wrong"); |
70 | ········} |
71 | |
72 | ········[Test] |
73 | ········public void TestAbstractRel() |
74 | ········{ |
75 | ············AbstractRelLeft left = new AbstractRelLeft(); |
76 | ············left.MyString = "Left"; |
77 | ············pm.MakePersistent(left); |
78 | ············ABB b = new ABB(); |
79 | ············b.MyString = "b"; |
80 | ············pm.MakePersistent(b); |
81 | ············pm.Save(); |
82 | ············left.AddABBase(b); |
83 | ············pm.Save(); |
84 | ············pm.UnloadCache(); |
85 | ············left = (AbstractRelLeft) pm.FindObject(left.NDOObjectId); |
86 | ············Assert.That(1 == left.TheBases.Count, "Count wrong"); |
87 | ········} |
88 | |
89 | |
90 | ····} |
91 | } |
92 |
New Commit (60cb179)
1 | // |
2 | // Copyright (c) 2002-2016 Mirko Matytschak |
3 | // (www.netdataobjects.de) |
4 | // |
5 | // Author: Mirko Matytschak |
6 | // |
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated |
8 | // documentation files (the "Software"), to deal in the Software without restriction, including without limitation |
9 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the |
10 | // Software, and to permit persons to whom the Software is furnished to do so, subject to the following |
11 | // conditions: |
12 | |
13 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions |
14 | // of the Software. |
15 | // |
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED |
17 | // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
18 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF |
19 | // CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. |
21 | |
22 | |
23 | using System; |
24 | using System.Collections; |
25 | using AbstractBaseTestClasses; |
26 | using NDO; |
27 | using NUnit.Framework; |
28 | |
29 | namespace NdoUnitTests |
30 | { |
31 | |
32 | ····[TestFixture] |
33 | public class AbstractBaseTests : NDOTest |
34 | ····{ |
35 | ········PersistenceManager pm; |
36 | |
37 | ········[SetUp] |
38 | ········public void Setup() |
39 | ········{ |
40 | ············this.pm = PmFactory.NewPersistenceManager(); |
41 | ········} |
42 | |
43 | |
44 | ········[TearDown] |
45 | ········public void TearDown() |
46 | ········{············ |
47 | ············IList l = pm.GetClassExtent(typeof(ABA)); |
48 | ············pm.Delete(l); |
49 | ············l = pm.GetClassExtent(typeof(ABB)); |
50 | ············pm.Delete(l); |
51 | ············pm.Dispose(); |
52 | ········} |
53 | |
54 | |
55 | ········[Test] |
56 | ········public void TestConcreteRel() |
57 | ········{ |
58 | ············ABA a = new ABA(); |
59 | ············a.MyString = "a"; |
60 | ············pm.MakePersistent(a); |
61 | ············ABB b = new ABB(); |
62 | ············b.MyString = "b"; |
63 | ············pm.MakePersistent(b); |
64 | ············pm.Save(); |
65 | ············b.AddA(a); |
66 | ············pm.Save(); |
67 | ············pm.UnloadCache(); |
68 | ············b = (ABB) pm.FindObject(b.NDOObjectId); |
69 | ············Assert.That(1 == b.MyA.Count, "Count wrong"); |
70 | ········} |
71 | |
72 | ········[Test] |
73 | ········public void TestAbstractRel() |
74 | ········{ |
75 | ············AbstractRelLeft left = new AbstractRelLeft(); |
76 | ············left.MyString = "Left"; |
77 | ············pm.MakePersistent(left); |
78 | ············ABB b = new ABB(); |
79 | ············b.MyString = "b"; |
80 | ············pm.MakePersistent(b); |
81 | ············pm.Save(); |
82 | ············left.AddABBase(b); |
83 | ············pm.Save(); |
84 | ············pm.UnloadCache(); |
85 | ············left = (AbstractRelLeft) pm.FindObject(left.NDOObjectId); |
86 | ············Assert.That(1 == left.TheBases.Count, "Count wrong"); |
87 | ········} |
88 | |
89 | |
90 | ····} |
91 | } |
92 |