Mercurial > repos > IBDev-IBBoard.WarFoundry.API.Tests
annotate API/Factories/Xml/WarFoundryXmlFactoryTests.cs @ 239:370bec16a364 default tip
Add initial testing for equipment with type (incomplete)
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 16 Oct 2016 20:29:35 +0100 |
parents | e173c5512067 |
children |
rev | line source |
---|---|
87
5c04db41d643
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
1 using System; |
5c04db41d643
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
2 using NUnit.Framework; |
5c04db41d643
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
3 using System.IO; |
5c04db41d643
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
4 using System.Collections.Generic; |
5c04db41d643
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
5 using IBBoard.WarFoundry.API.Objects; |
228
7c21ca1482cb
Re #419: Remove assumptions of a file-based install
IBBoard <dev@ibboard.co.uk>
parents:
96
diff
changeset
|
6 using IBBoard.WarFoundry.API.Loading; |
87
5c04db41d643
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
7 |
5c04db41d643
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
8 namespace IBBoard.WarFoundry.API.Factories.Xml |
5c04db41d643
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
9 { |
5c04db41d643
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
10 [TestFixture()] |
5c04db41d643
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
11 public class WarFoundryXmlFactoryTests |
5c04db41d643
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
12 { |
5c04db41d643
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
13 [Test()] |
5c04db41d643
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
14 public void TestFactoryHandlesMultipleFilesWithOldNamesInOneSystemZip() |
5c04db41d643
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
15 { |
90
5d19fee8e9dc
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
89
diff
changeset
|
16 EventListeningWarFoundryLoader loader = new EventListeningWarFoundryLoader(); |
89
90dee8d781ee
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
87
diff
changeset
|
17 WarFoundryLoader.SetDefault(loader); |
90
5d19fee8e9dc
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
89
diff
changeset
|
18 WarFoundryXmlFactory factory = WarFoundryXmlFactory.GetFactory(); |
96
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
19 try |
87
5c04db41d643
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
20 { |
96
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
21 loader.RegisterFactory(factory); |
228
7c21ca1482cb
Re #419: Remove assumptions of a file-based install
IBBoard <dev@ibboard.co.uk>
parents:
96
diff
changeset
|
22 ICollection<IWarFoundryObject> objs = factory.CreateObjectsFromFile(new LoadableFileObject("testdata/multifile-zips/Test.system")); |
238
e173c5512067
* Update to v2.6 of NUnit and new syntax/API changes
IBBoard <dev@ibboard.co.uk>
parents:
229
diff
changeset
|
23 Assert.That(objs, Has.Count.EqualTo(2)); |
96
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
24 int raceCount = 0; |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
25 int systemCount = 0; |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
26 |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
27 foreach (IWarFoundryObject obj in objs) |
87
5c04db41d643
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
28 { |
96
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
29 if (obj is Race) |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
30 { |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
31 raceCount++; |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
32 } |
229
6ec46f3db2d4
Re #419: Remove assumptions of a file-based install
IBBoard <dev@ibboard.co.uk>
parents:
228
diff
changeset
|
33 else if (obj is GameSystem) |
96
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
34 { |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
35 systemCount++; |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
36 } |
87
5c04db41d643
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
37 } |
96
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
38 |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
39 Assert.That(raceCount, Is.EqualTo(1)); |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
40 Assert.That(systemCount, Is.EqualTo(1)); |
87
5c04db41d643
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
41 } |
96
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
42 finally |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
43 { |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
44 loader.UnregisterFactory(factory); |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
45 } |
87
5c04db41d643
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
46 } |
90
5d19fee8e9dc
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
89
diff
changeset
|
47 |
5d19fee8e9dc
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
89
diff
changeset
|
48 [Test()] |
5d19fee8e9dc
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
89
diff
changeset
|
49 public void TestFactoryHandlesMultipleFilesWithOldNamesInOneRaceZip() |
5d19fee8e9dc
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
89
diff
changeset
|
50 { |
5d19fee8e9dc
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
89
diff
changeset
|
51 EventListeningWarFoundryLoader loader = new EventListeningWarFoundryLoader(); |
5d19fee8e9dc
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
89
diff
changeset
|
52 WarFoundryLoader.SetDefault(loader); |
5d19fee8e9dc
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
89
diff
changeset
|
53 WarFoundryXmlFactory factory = WarFoundryXmlFactory.GetFactory(); |
5d19fee8e9dc
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
89
diff
changeset
|
54 loader.RegisterFactory(factory); |
96
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
55 try |
90
5d19fee8e9dc
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
89
diff
changeset
|
56 { |
228
7c21ca1482cb
Re #419: Remove assumptions of a file-based install
IBBoard <dev@ibboard.co.uk>
parents:
96
diff
changeset
|
57 ICollection<IWarFoundryObject> objs = factory.CreateObjectsFromFile(new LoadableFileObject("testdata/multifile-zips/Test.race")); |
238
e173c5512067
* Update to v2.6 of NUnit and new syntax/API changes
IBBoard <dev@ibboard.co.uk>
parents:
229
diff
changeset
|
58 Assert.That(objs, Has.Count.EqualTo(2)); |
96
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
59 int raceCount = 0; |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
60 int systemCount = 0; |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
61 |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
62 foreach (IWarFoundryObject obj in objs) |
90
5d19fee8e9dc
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
89
diff
changeset
|
63 { |
96
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
64 if (obj is Race) |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
65 { |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
66 raceCount++; |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
67 } |
229
6ec46f3db2d4
Re #419: Remove assumptions of a file-based install
IBBoard <dev@ibboard.co.uk>
parents:
228
diff
changeset
|
68 else if (obj is GameSystem) |
96
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
69 { |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
70 systemCount++; |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
71 } |
90
5d19fee8e9dc
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
89
diff
changeset
|
72 } |
96
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
73 |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
74 Assert.That(raceCount, Is.EqualTo(1)); |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
75 Assert.That(systemCount, Is.EqualTo(1)); |
90
5d19fee8e9dc
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
89
diff
changeset
|
76 } |
96
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
77 finally |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
78 { |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
79 loader.UnregisterFactory(factory); |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
80 } |
90
5d19fee8e9dc
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
89
diff
changeset
|
81 } |
5d19fee8e9dc
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
89
diff
changeset
|
82 |
5d19fee8e9dc
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
89
diff
changeset
|
83 [Test()] |
5d19fee8e9dc
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
89
diff
changeset
|
84 public void TestFactoryHandlesMultipleFilesWithMultipleNewNamesInOneSystemZip() |
5d19fee8e9dc
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
89
diff
changeset
|
85 { |
5d19fee8e9dc
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
89
diff
changeset
|
86 EventListeningWarFoundryLoader loader = new EventListeningWarFoundryLoader(); |
5d19fee8e9dc
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
89
diff
changeset
|
87 WarFoundryLoader.SetDefault(loader); |
5d19fee8e9dc
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
89
diff
changeset
|
88 WarFoundryXmlFactory factory = WarFoundryXmlFactory.GetFactory(); |
5d19fee8e9dc
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
89
diff
changeset
|
89 loader.RegisterFactory(factory); |
96
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
90 try |
90
5d19fee8e9dc
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
89
diff
changeset
|
91 { |
228
7c21ca1482cb
Re #419: Remove assumptions of a file-based install
IBBoard <dev@ibboard.co.uk>
parents:
96
diff
changeset
|
92 ICollection<IWarFoundryObject> objs = factory.CreateObjectsFromFile(new LoadableFileObject("testdata/multifile-zips/Multipack.system")); |
238
e173c5512067
* Update to v2.6 of NUnit and new syntax/API changes
IBBoard <dev@ibboard.co.uk>
parents:
229
diff
changeset
|
93 Assert.That(objs, Has.Count.EqualTo(4)); |
96
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
94 int raceCount = 0; |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
95 int systemCount = 0; |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
96 |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
97 foreach (IWarFoundryObject obj in objs) |
90
5d19fee8e9dc
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
89
diff
changeset
|
98 { |
96
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
99 if (obj is Race) |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
100 { |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
101 raceCount++; |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
102 } |
229
6ec46f3db2d4
Re #419: Remove assumptions of a file-based install
IBBoard <dev@ibboard.co.uk>
parents:
228
diff
changeset
|
103 else if (obj is GameSystem) |
96
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
104 { |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
105 systemCount++; |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
106 } |
90
5d19fee8e9dc
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
89
diff
changeset
|
107 } |
229
6ec46f3db2d4
Re #419: Remove assumptions of a file-based install
IBBoard <dev@ibboard.co.uk>
parents:
228
diff
changeset
|
108 |
96
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
109 Assert.That(raceCount, Is.EqualTo(2)); |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
110 Assert.That(systemCount, Is.EqualTo(2)); |
90
5d19fee8e9dc
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
89
diff
changeset
|
111 } |
96
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
112 finally |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
113 { |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
114 loader.UnregisterFactory(factory); |
3c2c108a2f08
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
90
diff
changeset
|
115 } |
90
5d19fee8e9dc
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
89
diff
changeset
|
116 } |
229
6ec46f3db2d4
Re #419: Remove assumptions of a file-based install
IBBoard <dev@ibboard.co.uk>
parents:
228
diff
changeset
|
117 |
6ec46f3db2d4
Re #419: Remove assumptions of a file-based install
IBBoard <dev@ibboard.co.uk>
parents:
228
diff
changeset
|
118 [Test()] |
6ec46f3db2d4
Re #419: Remove assumptions of a file-based install
IBBoard <dev@ibboard.co.uk>
parents:
228
diff
changeset
|
119 public void TestLoadingRaceFromResource() |
6ec46f3db2d4
Re #419: Remove assumptions of a file-based install
IBBoard <dev@ibboard.co.uk>
parents:
228
diff
changeset
|
120 { |
6ec46f3db2d4
Re #419: Remove assumptions of a file-based install
IBBoard <dev@ibboard.co.uk>
parents:
228
diff
changeset
|
121 WarFoundryXmlFactory factory = WarFoundryXmlFactory.GetFactory(); |
6ec46f3db2d4
Re #419: Remove assumptions of a file-based install
IBBoard <dev@ibboard.co.uk>
parents:
228
diff
changeset
|
122 GameSystem system = new GameSystem("sample", "Sample System", factory); |
6ec46f3db2d4
Re #419: Remove assumptions of a file-based install
IBBoard <dev@ibboard.co.uk>
parents:
228
diff
changeset
|
123 FixedGameSystemWarFoundryLoader fixedLoader = new FixedGameSystemWarFoundryLoader(system); |
6ec46f3db2d4
Re #419: Remove assumptions of a file-based install
IBBoard <dev@ibboard.co.uk>
parents:
228
diff
changeset
|
124 WarFoundryLoader.SetDefault(fixedLoader); |
6ec46f3db2d4
Re #419: Remove assumptions of a file-based install
IBBoard <dev@ibboard.co.uk>
parents:
228
diff
changeset
|
125 ICollection<IWarFoundryObject> objs = factory.CreateObjectsFromFile(new LoadableResourceObject(typeof(WarFoundryLoader).Assembly, "IBBoard.WarFoundry.data.Empire.race")); |
238
e173c5512067
* Update to v2.6 of NUnit and new syntax/API changes
IBBoard <dev@ibboard.co.uk>
parents:
229
diff
changeset
|
126 Assert.That(objs, Has.Count.EqualTo(1)); |
229
6ec46f3db2d4
Re #419: Remove assumptions of a file-based install
IBBoard <dev@ibboard.co.uk>
parents:
228
diff
changeset
|
127 IEnumerator<IWarFoundryObject> enumerator = objs.GetEnumerator(); |
6ec46f3db2d4
Re #419: Remove assumptions of a file-based install
IBBoard <dev@ibboard.co.uk>
parents:
228
diff
changeset
|
128 enumerator.MoveNext(); |
6ec46f3db2d4
Re #419: Remove assumptions of a file-based install
IBBoard <dev@ibboard.co.uk>
parents:
228
diff
changeset
|
129 Assert.That(enumerator.Current, Is.TypeOf(typeof(Race))); |
6ec46f3db2d4
Re #419: Remove assumptions of a file-based install
IBBoard <dev@ibboard.co.uk>
parents:
228
diff
changeset
|
130 } |
6ec46f3db2d4
Re #419: Remove assumptions of a file-based install
IBBoard <dev@ibboard.co.uk>
parents:
228
diff
changeset
|
131 |
6ec46f3db2d4
Re #419: Remove assumptions of a file-based install
IBBoard <dev@ibboard.co.uk>
parents:
228
diff
changeset
|
132 [Test()] |
6ec46f3db2d4
Re #419: Remove assumptions of a file-based install
IBBoard <dev@ibboard.co.uk>
parents:
228
diff
changeset
|
133 public void TestLoadingSystemFromResource() |
6ec46f3db2d4
Re #419: Remove assumptions of a file-based install
IBBoard <dev@ibboard.co.uk>
parents:
228
diff
changeset
|
134 { |
6ec46f3db2d4
Re #419: Remove assumptions of a file-based install
IBBoard <dev@ibboard.co.uk>
parents:
228
diff
changeset
|
135 WarFoundryXmlFactory factory = WarFoundryXmlFactory.GetFactory(); |
6ec46f3db2d4
Re #419: Remove assumptions of a file-based install
IBBoard <dev@ibboard.co.uk>
parents:
228
diff
changeset
|
136 ICollection<IWarFoundryObject> objs = factory.CreateObjectsFromFile(new LoadableResourceObject(typeof(WarFoundryLoader).Assembly, "IBBoard.WarFoundry.data.SampleSystem.system")); |
238
e173c5512067
* Update to v2.6 of NUnit and new syntax/API changes
IBBoard <dev@ibboard.co.uk>
parents:
229
diff
changeset
|
137 Assert.That(objs, Has.Count.EqualTo(1)); |
229
6ec46f3db2d4
Re #419: Remove assumptions of a file-based install
IBBoard <dev@ibboard.co.uk>
parents:
228
diff
changeset
|
138 IEnumerator<IWarFoundryObject> enumerator = objs.GetEnumerator(); |
6ec46f3db2d4
Re #419: Remove assumptions of a file-based install
IBBoard <dev@ibboard.co.uk>
parents:
228
diff
changeset
|
139 enumerator.MoveNext(); |
6ec46f3db2d4
Re #419: Remove assumptions of a file-based install
IBBoard <dev@ibboard.co.uk>
parents:
228
diff
changeset
|
140 Assert.That(enumerator.Current, Is.TypeOf(typeof(GameSystem))); |
6ec46f3db2d4
Re #419: Remove assumptions of a file-based install
IBBoard <dev@ibboard.co.uk>
parents:
228
diff
changeset
|
141 } |
87
5c04db41d643
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
142 } |
5c04db41d643
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
143 } |