Mercurial > repos > IBDev-IBBoard.WarFoundry.API.Tests
annotate API/Factories/Mock/MockSystemFactory.cs @ 203:2b27447ae74e
Re #352: Test/fix cyclic references in unit types
* Add test case
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 21 Jan 2012 21:01:02 +0000 |
parents | 31fd34f7d7cf |
children |
rev | line source |
---|---|
12
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
1 // This file (MockSystemFactory.cs) is a part of the IBBoard.WarFoundry.API.Tests project and is copyright 2008, 2009 IBBoard. |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
2 // |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
3 // The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
4 |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
5 using System; |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
6 using System.IO; |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
7 using IBBoard.WarFoundry.API.Factories; |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
8 using IBBoard.WarFoundry.API.Objects; |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
9 using ICSharpCode.SharpZipLib.Zip; |
88
31fd34f7d7cf
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
12
diff
changeset
|
10 using System.Collections.Generic; |
12
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
11 |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
12 namespace IBBoard.WarFoundry.API.Factories.Mock |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
13 { |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
14 public class MockSystemFactory : AbstractNativeWarFoundryFactory |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
15 { |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
16 private static MockSystemFactory mock; |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
17 |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
18 public static MockSystemFactory GetMockFactory() |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
19 { |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
20 if (mock == null) |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
21 { |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
22 mock = new MockSystemFactory(); |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
23 } |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
24 |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
25 return mock; |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
26 } |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
27 |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
28 public MockSystemFactory() |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
29 { |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
30 } |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
31 |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
32 protected override bool CheckCanFindArmyFileContent(ZipFile file) |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
33 { |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
34 return false; |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
35 } |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
36 |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
37 protected override bool CheckCanFindRaceFileContent(ZipFile file) |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
38 { |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
39 return false; |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
40 } |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
41 |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
42 protected override bool CheckCanFindSystemFileContent(ZipFile file) |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
43 { |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
44 return true; |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
45 } |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
46 |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
47 protected override Army CreateArmyFromStream (ZipFile file, Stream dataStream) |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
48 { |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
49 throw new NotImplementedException (); |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
50 } |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
51 |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
52 protected override GameSystem CreateGameSystemFromStream (ZipFile file, Stream dataStream) |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
53 { |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
54 return new GameSystem("test", "Test System", this); |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
55 } |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
56 |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
57 protected override Race CreateRaceFromStream (ZipFile file, Stream dataStream) |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
58 { |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
59 throw new NotImplementedException (); |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
60 } |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
61 |
88
31fd34f7d7cf
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
12
diff
changeset
|
62 protected override ICollection<ZipEntry> GetArmyZipEntries(ZipFile file) |
12
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
63 { |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
64 throw new NotImplementedException (); |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
65 } |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
66 |
88
31fd34f7d7cf
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
12
diff
changeset
|
67 protected override ICollection<ZipEntry> GetGameSystemZipEntries (ZipFile file) |
12
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
68 { |
88
31fd34f7d7cf
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
12
diff
changeset
|
69 List<ZipEntry> entries = new List<ZipEntry>(); |
31fd34f7d7cf
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
12
diff
changeset
|
70 ZipEntry zipEntry = file.GetEntry("data.systemx"); |
31fd34f7d7cf
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
12
diff
changeset
|
71 if (zipEntry != null) |
31fd34f7d7cf
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
12
diff
changeset
|
72 { |
31fd34f7d7cf
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
12
diff
changeset
|
73 entries.Add(zipEntry); |
31fd34f7d7cf
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
12
diff
changeset
|
74 } |
31fd34f7d7cf
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
12
diff
changeset
|
75 return entries; |
12
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
76 } |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
77 |
88
31fd34f7d7cf
Re #253: Allow multiple data files in a single zip
IBBoard <dev@ibboard.co.uk>
parents:
12
diff
changeset
|
78 protected override ICollection<ZipEntry> GetRaceZipEntries (ZipFile file) |
12
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
79 { |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
80 throw new NotImplementedException (); |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
81 } |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
82 } |
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
83 } |