Mercurial > repos > IBBoard.WarFoundry.API.Tests
annotate API/WarFoundryLoaderTest.cs @ 12:a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
* Initial commit of tests for limits (percentage and numeric)
Also:
* Reshuffle and refactoring of existing tests
* Additional mocks required by the new tests
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Mon, 12 Oct 2009 19:42:30 +0000 |
parents | WarFoundryLoaderTest.cs@8d9d49332d44 |
children | 4302e6b2c5c1 |
rev | line source |
---|---|
11 | 1 // This file (WarFoundryLoaderTest.cs) is a part of the IBBoard.WarFoundry.API.Tests project and is copyright 2008, 2009 IBBoard. |
0 | 2 // |
11 | 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. |
0 | 4 |
5 using System; | |
6 using System.IO; | |
7 using NUnit.Framework; | |
12
a4e7e938d065
Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
11
diff
changeset
|
8 using IBBoard.WarFoundry.API.Factories.Mock; |
0 | 9 using IBBoard.WarFoundry.API.Objects; |
10 | |
11 namespace IBBoard.WarFoundry.API.Factories | |
12 { | |
13 [TestFixture()] | |
14 public class WarFoundryLoaderTest | |
15 { | |
9 | 16 private AbstractNativeWarFoundryFactory sysFactory; |
0 | 17 |
18 [Test()] | |
19 public void TestLoadWithoutFactoriesCompletesWithoutError() | |
20 { | |
21 WarFoundryLoader.GetDefault().LoadFiles(); | |
22 } | |
23 | |
24 [Test()] | |
25 public void TestLoadingSystemCompletesWithoutError() | |
26 { | |
9 | 27 WarFoundryLoader loader = WarFoundryLoader.GetDefault(); |
28 DirectoryInfo dir = new DirectoryInfo("testdata"); | |
29 loader.RegisterFactory(GetSystemFactory()); | |
0 | 30 loader.AddLoadDirectory(dir); |
31 loader.LoadFiles(); | |
32 Assert.Greater(loader.GetGameSystems().Length, 0); | |
33 loader.RemoveLoadDirectory(dir); | |
9 | 34 loader.UnregisterFactory(GetSystemFactory()); |
0 | 35 } |
36 | |
9 | 37 private AbstractNativeWarFoundryFactory GetSystemFactory() |
0 | 38 { |
9 | 39 if (sysFactory == null) |
0 | 40 { |
9 | 41 sysFactory = new MockSystemFactory(); |
0 | 42 } |
43 | |
9 | 44 return sysFactory; |
0 | 45 } |
46 } | |
47 } |