Mercurial > repos > IBBoard.WarFoundry.API.Tests
annotate API/Factories/AbstractNativeWarFoundryFactoryTest.cs @ 167:03ccff4d5e8a
Re #94: Loading files is too slow
* ACTUALLY fix the tests - Linux is somehow fast enough that it passes anyway, but Windows in VM failed
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Wed, 07 Sep 2011 20:38:42 +0100 |
parents | 6b9e86d4be95 |
children | 6dce5122caca |
rev | line source |
---|---|
165 | 1 // This file (AbstractNativeWarFoundryFactoryTest.cs) is a part of the IBBoard.WarFoundry.API.Tests project and is copyright 2011 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 using System; | |
5 using NUnit.Framework; | |
6 using IBBoard.WarFoundry.API.Factories.Mock; | |
7 using System.Diagnostics; | |
8 using NUnit.Framework.SyntaxHelpers; | |
9 using System.IO; | |
10 | |
11 namespace IBBoard.WarFoundry.API.Factories | |
12 { | |
13 [TestFixture] | |
14 public class AbstractNativeWarFoundryFactoryTest | |
15 { | |
16 [Test] | |
17 public void Bug94TestLoadingTimesForNonZipFiles() | |
18 { | |
19 MockNativeWarFoundryFactory factory = new MockNativeWarFoundryFactory(); | |
20 Stopwatch sw = Stopwatch.StartNew(); | |
21 factory.CreateObjectsFromFile(new FileInfo("testdata/Test.race")); | |
22 sw.Stop(); | |
23 long successElapsed = sw.ElapsedMilliseconds; | |
24 sw.Reset(); | |
25 sw.Start(); | |
167
03ccff4d5e8a
Re #94: Loading files is too slow
IBBoard <dev@ibboard.co.uk>
parents:
166
diff
changeset
|
26 factory.CreateObjectsFromFile(new FileInfo("testdata/NotARaceFile.txt")); |
165 | 27 sw.Stop(); |
28 long failedElapsed = sw.ElapsedMilliseconds; | |
29 long timeRatio = failedElapsed / successElapsed; | |
30 Assert.That(timeRatio, Is.LessThan(10)); | |
31 } | |
166
6b9e86d4be95
Re #358: Handle factory.CreateObjectsFromFile where GetFileAsSupportedType returns null
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
32 |
6b9e86d4be95
Re #358: Handle factory.CreateObjectsFromFile where GetFileAsSupportedType returns null
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
33 [Test] |
6b9e86d4be95
Re #358: Handle factory.CreateObjectsFromFile where GetFileAsSupportedType returns null
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
34 public void Bug358TestLoadingOfFailedFiles() |
6b9e86d4be95
Re #358: Handle factory.CreateObjectsFromFile where GetFileAsSupportedType returns null
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
35 { |
6b9e86d4be95
Re #358: Handle factory.CreateObjectsFromFile where GetFileAsSupportedType returns null
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
36 MockNativeWarFoundryFactory factory = new MockNativeWarFoundryFactory(); |
6b9e86d4be95
Re #358: Handle factory.CreateObjectsFromFile where GetFileAsSupportedType returns null
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
37 //This will also be triggered by Bug94TestLoadingTimesForNonZipFiles, but this makes it separate and explicit |
6b9e86d4be95
Re #358: Handle factory.CreateObjectsFromFile where GetFileAsSupportedType returns null
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
38 factory.CreateObjectsFromFile(new FileInfo("testdata/TextFileWithWrongExtension.race")); |
6b9e86d4be95
Re #358: Handle factory.CreateObjectsFromFile where GetFileAsSupportedType returns null
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
39 } |
165 | 40 } |
41 } | |
42 |