Mercurial > repos > IBBoard.WarFoundry.API.Tests
annotate WarFoundryLoaderTest.cs @ 5:90f63edddc94
Re #30 - Migrate WarFoundry to .csproj
* Migrate API tests to .csproj and remove .mdp
Also remove old test results from source control
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Tue, 17 Feb 2009 16:30:12 +0000 |
parents | 4222cfa99c78 |
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 } |