Mercurial > repos > IBBoard.WarFoundry.API.Tests
annotate WarFoundryLoaderTest.cs @ 4:4222cfa99c78
Re #1 - LGPL license all code
* Add LGPL header to all files
* Add COPYING.LGPL and COPYING.GPL with content of license
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 25 Jan 2009 14:51:41 +0000 |
parents | 40b31dfd6a46 |
children | f96169484ba5 |
rev | line source |
---|---|
4 | 1 // This file (WarFoundryLoaderTest.cs) is a part of the IBBoard.WarFoundry.API.Tests project and is copyright 2009 IBBoard. |
0 | 2 // |
4 | 3 // The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL for more information and the full license. |
0 | 4 |
5 using System; | |
6 using System.IO; | |
7 using NUnit.Framework; | |
8 using IBBoard.WarFoundry.API.Objects; | |
9 | |
10 namespace IBBoard.WarFoundry.API.Factories | |
11 { | |
12 [TestFixture()] | |
13 public class WarFoundryLoaderTest | |
14 { | |
15 private AbstractNativeWarFoundryFactory factory; | |
16 | |
17 [Test()] | |
18 public void TestLoadWithoutFactoriesCompletesWithoutError() | |
19 { | |
20 WarFoundryLoader.GetDefault().LoadFiles(); | |
21 } | |
22 | |
23 [Test()] | |
24 public void TestLoadingSystemCompletesWithoutError() | |
25 { | |
26 WarFoundryLoader loader = GetSystemLoader(); | |
3
40b31dfd6a46
Update tests (one currently fails because of "end of stream" that doesn't occur when using factories normally)
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
27 DirectoryInfo dir = new DirectoryInfo("."); |
0 | 28 loader.RegisterFactory(GetFactory()); |
29 loader.AddLoadDirectory(dir); | |
30 loader.LoadFiles(); | |
31 Assert.Greater(loader.GetGameSystems().Length, 0); | |
32 loader.RemoveLoadDirectory(dir); | |
33 loader.UnregisterFactory(GetFactory()); | |
34 } | |
35 | |
36 private AbstractNativeWarFoundryFactory GetFactory() | |
37 { | |
38 if (factory == null) | |
39 { | |
40 factory = new MockFactory(); | |
41 } | |
42 | |
43 return factory; | |
44 } | |
45 | |
46 private WarFoundryLoader GetSystemLoader() | |
47 { | |
48 return new FixedFileWarFoundryLoader(new MockSystemZipFile()); | |
49 } | |
50 | |
51 private WarFoundryLoader GetRaceLoader() | |
52 { | |
53 return new FixedFileWarFoundryLoader(new MockRaceZipFile()); | |
54 } | |
55 } | |
56 } |