Datei: IntegrationTests/IntegrationTests/DoubleRelationTests.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.Generic; |
25 | using System.Text; |
26 | using NUnit.Framework; |
27 | using NDO; |
28 | using DoubleRelationClasses; |
29 | |
30 | namespace NdoUnitTests |
31 | { |
32 | ····[TestFixture] |
33 | public class DoubleRelationTests |
34 | ····{ |
35 | ········[SetUp] |
36 | ········public void Setup() |
37 | ········{ |
38 | ········} |
39 | |
40 | ········[TearDown] |
41 | ········public void TearDown() |
42 | ········{ |
43 | ············var pm = PmFactory.NewPersistenceManager(); |
44 | ············var l = pm.Objects<DRPerson>().ResultTable; |
45 | ············pm.Delete( l ); |
46 | ············pm.Save(); |
47 | ············pm.Close(); |
48 | ········} |
49 | |
50 | ········[Test] |
51 | ········public void TestDoubleRelation() |
52 | ········{ |
53 | ············var pm = PmFactory.NewPersistenceManager(); |
54 | ············DRPerson oPerson1 = new DRPerson(); |
55 | ············pm.MakePersistent(oPerson1); |
56 | ············oPerson1.DefaultAddress = oPerson1.NewAddress(); |
57 | ············oPerson1.Name = "Hello World 1"; |
58 | |
59 | ············DRPerson oPerson2 = new DRPerson(); |
60 | ············pm.MakePersistent(oPerson2); |
61 | ············oPerson2.DefaultAddress = oPerson2.NewAddress(); |
62 | ············oPerson2.Name = "Hello World 2"; |
63 | |
64 | ············pm.Delete(oPerson2); |
65 | ············pm.Save(); |
66 | ········} |
67 | ····} |
68 | } |
69 |
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.Generic; |
25 | using System.Text; |
26 | using NUnit.Framework; |
27 | using NDO; |
28 | using DoubleRelationClasses; |
29 | |
30 | namespace NdoUnitTests |
31 | { |
32 | ····[TestFixture] |
33 | public class DoubleRelationTests : NDOTest |
34 | ····{ |
35 | ········[SetUp] |
36 | ········public void Setup() |
37 | ········{ |
38 | ········} |
39 | |
40 | ········[TearDown] |
41 | ········public void TearDown() |
42 | ········{ |
43 | ············var pm = PmFactory.NewPersistenceManager(); |
44 | ············var l = pm.Objects<DRPerson>().ResultTable; |
45 | ············pm.Delete( l ); |
46 | ············pm.Save(); |
47 | ············pm.Close(); |
48 | ········} |
49 | |
50 | ········[Test] |
51 | ········public void TestDoubleRelation() |
52 | ········{ |
53 | ············var pm = PmFactory.NewPersistenceManager(); |
54 | ············DRPerson oPerson1 = new DRPerson(); |
55 | ············pm.MakePersistent(oPerson1); |
56 | ············oPerson1.DefaultAddress = oPerson1.NewAddress(); |
57 | ············oPerson1.Name = "Hello World 1"; |
58 | |
59 | ············DRPerson oPerson2 = new DRPerson(); |
60 | ············pm.MakePersistent(oPerson2); |
61 | ············oPerson2.DefaultAddress = oPerson2.NewAddress(); |
62 | ············oPerson2.Name = "Hello World 2"; |
63 | |
64 | ············pm.Delete(oPerson2); |
65 | ············pm.Save(); |
66 | ········} |
67 | ····} |
68 | } |
69 |