comparison 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
comparison
equal deleted inserted replaced
11:8d9d49332d44 12:a4e7e938d065
1 // This file (WarFoundryLoaderTest.cs) is a part of the IBBoard.WarFoundry.API.Tests project and is copyright 2008, 2009 IBBoard.
2 //
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.
4
5 using System;
6 using System.IO;
7 using NUnit.Framework;
8 using IBBoard.WarFoundry.API.Factories.Mock;
9 using IBBoard.WarFoundry.API.Objects;
10
11 namespace IBBoard.WarFoundry.API.Factories
12 {
13 [TestFixture()]
14 public class WarFoundryLoaderTest
15 {
16 private AbstractNativeWarFoundryFactory sysFactory;
17
18 [Test()]
19 public void TestLoadWithoutFactoriesCompletesWithoutError()
20 {
21 WarFoundryLoader.GetDefault().LoadFiles();
22 }
23
24 [Test()]
25 public void TestLoadingSystemCompletesWithoutError()
26 {
27 WarFoundryLoader loader = WarFoundryLoader.GetDefault();
28 DirectoryInfo dir = new DirectoryInfo("testdata");
29 loader.RegisterFactory(GetSystemFactory());
30 loader.AddLoadDirectory(dir);
31 loader.LoadFiles();
32 Assert.Greater(loader.GetGameSystems().Length, 0);
33 loader.RemoveLoadDirectory(dir);
34 loader.UnregisterFactory(GetSystemFactory());
35 }
36
37 private AbstractNativeWarFoundryFactory GetSystemFactory()
38 {
39 if (sysFactory == null)
40 {
41 sysFactory = new MockSystemFactory();
42 }
43
44 return sysFactory;
45 }
46 }
47 }